For arithmetic types T, one can have a class that contains a conversion operator :
template <typename T>
class Value
{
constexpr operator T() const;
};
Is this operator is available for all types (as an example, is it working for T = std::vector<double>?) and if not, for what types does it work?
A type is a type: there are very few things that you can do with
a built-in type, and not with a appropriately defined user
defined type. In this case, about the only real requirement is
that the type be copyable (and that you have some way of
constructing it in the implementation).
And BTW, I think you meant:
(except that for a lot of types, it won’t really be usable as
a
const,constexpror no).