This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
is_explicitly_convertible
- From: Daniel Frey <d dot frey at gmx dot de>
- To: libstdc++ at gcc dot gnu dot org
- Date: Tue, 29 Dec 2009 16:37:31 +0100
- Subject: is_explicitly_convertible
Hi,
as requested by Paolo Carlini, I post my implementation of C++0x's std::is_explicitly_convertible here. Note I have no idea what the actual style-guides dictate, but I hope that someone can use my work to add a complete and correct implementation to libstdc++ and write some tests for it :)
namespace std
{
template<typename _T>
_T __is_explicitly_convertible_make();
template<typename _From, typename _To>
decltype(_To(__is_explicitly_convertible_make<_From>()), __is_explicitly_convertible_make<true_type>()) __is_explicitly_convertible_helper(int);
template<typename _From, typename _To>
false_type __is_explicitly_convertible_helper(...);
template<typename _From, typename _To>
struct is_explicitly_convertible
: public is_same<decltype(__is_explicitly_convertible_helper<_From, _To>(0)), true_type>
{ };
}
Note that GCC 4.4+ is required, GCC 4.3 doesn't work with the above.
Regards, Daniel