metaprogramming: trait to detect smart-pointers

This commit is contained in:
Fischlurch 2016-07-30 21:54:16 +02:00
parent 020940545c
commit 52918b069f
2 changed files with 27 additions and 0 deletions

View file

@ -319,6 +319,24 @@ namespace meta {
/** detect smart pointers */
template<typename X>
struct is_smart_ptr
: std::false_type
{ };
template<typename T>
struct is_smart_ptr<std::shared_ptr<T>>
: std::true_type
{ };
template <typename T, typename D>
struct is_smart_ptr<std::unique_ptr<T,D>>
: std::true_type
{ };

View file

@ -52,6 +52,15 @@ namespace std { // forward declaration for std::string...
class basic_string;
using string = basic_string<char, char_traits<char>, allocator<char>>;
// forward declarations for common smart ptrs
template<typename T>
class shared_ptr;
template <typename T, typename D>
class unique_ptr;
}