We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exercise 7.53: Define your own version of Debug.
If you're using C++ 14(or higher) to compile the answer, the any() function, which is defined as:
constexpr bool any() {return hw || io || other; } (line 16)
constexpr bool any() {return hw || io || other; }
must be written in:
constexpr bool any() const {return hw || io || other; }
in order to claim itself a const member function. Otherwise the compiler will complain:
error: passing ‘const Debug’ as ‘this’ argument discards qualifiers [-fpermissive]
i hope this helps!
Ref: Difference between constexpr and const
constexpr
const
See the B section in the first answer.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Exercise information
Exercise 7.53: Define your own version of Debug.
Question or Bug
If you're using C++ 14(or higher) to compile the answer, the any() function, which is defined as:
constexpr bool any() {return hw || io || other; }
(line 16)must be written in:
constexpr bool any() const {return hw || io || other; }
in order to claim itself a const member function. Otherwise the compiler will complain:
error: passing ‘const Debug’ as ‘this’ argument discards qualifiers [-fpermissive]
i hope this helps!
Ref: Difference between
constexpr
andconst
See the B section in the first answer.
Enviroment information
The text was updated successfully, but these errors were encountered: