On 08/17/17 08:33, Gavin Lambert via Boost wrote:
On 17/08/2017 16:35, dodheim wrote:
Boost - Dev mailing list wrote
On 17/08/2017 13:27, Glen Fernandes wrote:
This is to detect a member 'impl_ptr_type' type? Just:
template<class, class = void> struct has_impl_ptr_type : boost::false_type { }; template <class T> struct has_impl_ptr_type<T, boost::void_t<typename T::impl_ptr_type> > : boost::true_type { };
That *is* a nicer way to do it. Requires a minimum of Boost 1.64 or C++17, though. (Or VS2015, apparently.)
This only requires C++11; it doesn't work on earlier versions of MSVC because MSVC was (and still is) lagging behind on support for expression-SFINAE.
std::void_t does not exist until C++17. However the VS2015 STL adds it anyway.
boost::void_t does not exist until 1.64. However it only works on compilers that support expression-SFINAE (which is most C++11 compilers except VS, until VS2015).
Boost.Core has had enable_if_has_type for this purpose for a long time. By itself, neither void_t nor enable_if_has_type requires expression SFINAE. It will only require one in some uses, typically involving decltype, when you test if an expression is valid (i.e. has a type). It works with as far as C++03 with regard to testing for nested types.