Skip to content
Snippets Groups Projects
Commit 68ad2a7f authored by René Fritze's avatar René Fritze Committed by René Fritze
Browse files

[type_traits] simplify is_smart_ptr

parent ef51196f
No related branches found
No related tags found
1 merge request!31Sfinae and stuff
......@@ -250,31 +250,12 @@ std::string get_template_basename(const T&)
return str.substr(0, r);
}
template <class T, class Ptr = void>
struct is_smart_ptr
{
static const bool value = false;
typedef T type;
};
template <class T>
struct is_smart_ptr<T, typename std::enable_if<std::is_same<std::unique_ptr<typename T::element_type>, T>::value>::type>
{
static const bool value = true;
typedef T type;
};
template <class T>
struct is_smart_ptr<T, typename std::enable_if<std::is_same<std::shared_ptr<typename T::element_type>, T>::value>::type>
{
static const bool value = true;
typedef T type;
};
template <class T>
struct is_smart_ptr<T, typename std::enable_if<std::is_same<std::weak_ptr<typename T::element_type>, T>::value>::type>
struct is_smart_ptr
{
static const bool value = true;
static const bool value = std::is_same<std::unique_ptr<typename T::element_type>, T>::value
|| std::is_same<std::shared_ptr<typename T::element_type>, T>::value
|| std::is_same<std::weak_ptr<typename T::element_type>, T>::value;
typedef T type;
};
......
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