As of C++11, similar to declaring single-argument constructors explicit
, you can declare conversion operators explicit
to prevent the compiler from using them to perform implicit conversions. For example, the prototype:
explicit MyClass::operator char *() const;
declares MyClass
’s char *
cast operator explicit
.
18.117.138.178