Skip to content
Snippets Groups Projects
Commit 0cd0b4da authored by Jan Travnicek's avatar Jan Travnicek
Browse files

fix use of c-array in has_clone trait

parent a1532429
No related branches found
No related tags found
1 merge request!95Many clang-tidy fixes
Pipeline #40799 passed with warnings
......@@ -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 ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment