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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

John Maddock-3
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.


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

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

Vicente Botet
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/html/boost/conversion/reference.html#boost.conversion.reference.type_traits_extensions and

https://svn.boost.org/svn/boost/sandbox/conversion/boost/conversion/type_traits/
).

HTH,
Vicente
Reply | Threaded
Open this post in threaded view
|

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

John Maddock-3
> 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/html/boost/conversion/reference.html#boost.conversion.reference.type_traits_extensions
> and
>
> https://svn.boost.org/svn/boost/sandbox/conversion/boost/conversion/type_traits/
> ).
>
> HTH,
> Vicente

Definitely helps, will investigate more.

Many thanks, John.


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost