Yes. This is the example for problems with only having implicit user-defined conversions and explicit user-defined conversion operators were practically invented because of this problem and to replace all the safe-bool stuff with something a lot cleaner and more logical.
More Related Contents:
- What is a smart pointer and when should I use one?
- What is move semantics?
- What is a lambda expression in C++11?
- What are rvalues, lvalues, xvalues, glvalues, and prvalues?
- What are the main purposes of using std::forward and which problems it solves?
- Why should I use a pointer rather than the object itself?
- What is “rvalue reference for *this”?
- What does T&& (double ampersand) mean in C++11?
- C++11 rvalues and move semantics confusion (return statement)
- Which kind of pointer do I use when?
- What is std::move(), and when should it be used?
- Does const mean thread-safe in C++11?
- How can I efficiently select a Standard Library container in C++11?
- Why is `std::move` named `std::move`?
- What are the advantages of using nullptr?
- Is the ‘override’ keyword just a check for a overridden virtual method?
- Passing shared pointers as arguments
- What are the main purposes of std::forward and which problems does it solve?
- When do extra parentheses have an effect, other than on operator precedence?
- When to make a type non-movable in C++11?
- What is std::move(), and when should it be used and does it actually move anything?
- Legality of COW std::string implementation in C++11
- What’s the best way to iterate over two or more containers simultaneously
- How do I get the argument types of a function pointer in a variadic template class?
- Can lambda functions be templated?
- Disambiguate overloaded member function pointer being passed as template parameter
- Why do objects returned from bind ignore extra arguments?
- std::shared_ptr thread safety explained
- What happens if ‘throw’ fails to allocate memory for exception object?
- What is the purpose of a declaration like int (x); or int (x) = 10;