This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]