diff --git a/alib2std/src/extensions/type_traits.hpp b/alib2std/src/extensions/type_traits.hpp index a9b177a9d023884131615a5daa74e98a73b42806..21e496c8a86923bd47358d24be0da46798d1943e 100644 --- a/alib2std/src/extensions/type_traits.hpp +++ b/alib2std/src/extensions/type_traits.hpp @@ -39,20 +39,18 @@ namespace ext { template<class T> struct has_clone { private: - typedef char (&Yes)[1]; - typedef char (&No)[2]; - - template<class U> - static Yes test(U * data, typename std::enable_if< std::is_pointer<decltype(data->clone())>::value>::type * = nullptr); - static No test(...); + template < class U > + static std::true_type test ( U * data, typename std::enable_if < std::is_pointer_v < decltype ( data->clone ( ) ) > >::type * = nullptr ); + static std::false_type test ( ... ); public: /** * \brief * True if the type decayed type T has clone method. */ - static const bool value = sizeof(Yes) == sizeof(has_clone::test((typename std::decay<T>::type*)nullptr)); + static const bool value = decltype ( has_clone::test ( std::declval < std::decay_t < T > * > ( ) ) )::value; }; + /** * \brief * Positive supports test implementation. The test is designed to detect call availability on callable F with parameters Ts ...