Any chance to use enable_if
with a type conversion operator? Seems tricky, since both return type and parameters list are implicit.
Actually, I have found a way; we use a private, unused class to mark a conversion that shouldn't exist, and we use boost::mpl::if_
to select whether to produce a conversion to NoConversion, or to the desired type.
class A {
class NoConversion { };
template operator typename boost::mpl::if_::type() const;
}