[type_traits] Is it possible to test for an explicit conversion?

OK, so we don't have such a trait at present, but one of the requests from the multiprecision review was "make conversions explicit in the front end if they are in the backend". Which to do it nicely (and semi-automagically) requires a trait that tests whether A is explicitly convertible to B. Which would obviously make a useful type trait in it's own right, but.... anyone have any ideas on how such a trait could be implemented? At present it looks "impossible" to me, but I've learned never to say never ;-) Thanks, John.

John Maddock-3 wrote
OK, so we don't have such a trait at present, but one of the requests from the multiprecision review was "make conversions explicit in the front end if they are in the backend". Which to do it nicely (and semi-automagically) requires a trait that tests whether A is explicitly convertible to B. Which would obviously make a useful type trait in it's own right, but.... anyone have any ideas on how such a trait could be implemented? At present it looks "impossible" to me, but I've learned never to say never ;-)
Thanks, John.
Hi, I don't know on which state there are the traits I introduced in the rejected Boost.Conversion: is_assignable.hpp is_constructible.hpp is_convertible.hpp is_copy_assignable.hpp is_copy_constructible.hpp is_default_constructible.hpp is_destructible.hpp is_explicitly_convertible.hpp is_move_assignable.hpp is_move_constructible.hpp Of course, there should be some limitation with older compilers. (See https://svn.boost.org/svn/boost/sandbox/conversion/libs/conversion_ext/doc/h... and https://svn.boost.org/svn/boost/sandbox/conversion/boost/conversion/type_tra... ). HTH, Vicente -- View this message in context: http://boost.2283326.n4.nabble.com/type-traits-Is-it-possible-to-test-for-an... Sent from the Boost - Dev mailing list archive at Nabble.com.

I don't know on which state there are the traits I introduced in the rejected Boost.Conversion:
is_assignable.hpp is_constructible.hpp is_convertible.hpp is_copy_assignable.hpp is_copy_constructible.hpp is_default_constructible.hpp is_destructible.hpp is_explicitly_convertible.hpp is_move_assignable.hpp is_move_constructible.hpp
Of course, there should be some limitation with older compilers.
(See https://svn.boost.org/svn/boost/sandbox/conversion/libs/conversion_ext/doc/h... and
https://svn.boost.org/svn/boost/sandbox/conversion/boost/conversion/type_tra... ).
HTH, Vicente
Definitely helps, will investigate more. Many thanks, John.
participants (2)
-
John Maddock
-
Vicente Botet