I'd like to enable conversion of my class to a double value. This can be achieved by overloading operator double()
but this then allows for implicit conversion, which ideally I'd like to be able to avoid.
Is there any way to add this functionality but with the requirement that conversions are made using double y = static_cast<double>(x)
rather the implicitly being made; double y = x
?
I'm using C++17. Thanks