From 52918b069fbf29d038033cd2bf62dd8b1c7bc0c3 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 30 Jul 2016 21:54:16 +0200 Subject: [PATCH] metaprogramming: trait to detect smart-pointers --- src/lib/meta/trait.hpp | 18 ++++++++++++++++++ src/lib/meta/util.hpp | 9 +++++++++ 2 files changed, 27 insertions(+) diff --git a/src/lib/meta/trait.hpp b/src/lib/meta/trait.hpp index 49e0ebd76..e9920f9c1 100644 --- a/src/lib/meta/trait.hpp +++ b/src/lib/meta/trait.hpp @@ -319,6 +319,24 @@ namespace meta { + /** detect smart pointers */ + template + struct is_smart_ptr + : std::false_type + { }; + + template + struct is_smart_ptr> + : std::true_type + { }; + + template + struct is_smart_ptr> + : std::true_type + { }; + + + diff --git a/src/lib/meta/util.hpp b/src/lib/meta/util.hpp index 15735a923..0cdc3db58 100644 --- a/src/lib/meta/util.hpp +++ b/src/lib/meta/util.hpp @@ -52,6 +52,15 @@ namespace std { // forward declaration for std::string... class basic_string; using string = basic_string, allocator>; + + + // forward declarations for common smart ptrs + template + class shared_ptr; + + template + class unique_ptr; + }