I get the Compiler Error C2071 when I try to implement the explicit operator bool:
class C
{
public:
explicit operator bool() const
{
return !!*this;
}
};
Why? How can I solve this problem?
I’m using Visual Studio 2012 RC.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Visual Studio 2012 does not support explicit conversion operators, see C++11 Features in Visual C++ 11.
These articles talk about the safe bool idiom: