Kagome
Polkadot Runtime Engine in C++17
type_traits.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_TYPE_TRAITS
7 #define KAGOME_TYPE_TRAITS
8 
9 namespace kagome {
10 
11  // SFINAE-way for detect shared pointer
12  template <typename T>
13  struct is_shared_ptr : std::false_type {};
14  template <typename T>
15  struct is_shared_ptr<std::shared_ptr<T>> : std::true_type {};
16 
17  // SFINAE-way for detect unique pointer
18  template <typename T>
19  struct is_unique_ptr : std::false_type {};
20  template <typename T>
21  struct is_unique_ptr<std::unique_ptr<T>> : std::true_type {};
22 
23  // SFINAE-way for detect unique and smart pointers both
24  template <typename T>
25  struct is_smart_ptr : std::false_type {};
26  template <typename T>
27  struct is_smart_ptr<std::unique_ptr<T>> : std::true_type {};
28  template <typename T>
29  struct is_smart_ptr<std::shared_ptr<T>> : std::true_type {};
30 
31 } // namespace kagome
32 #endif // KAGOME_TYPE_TRAITS
STL namespace.