diff --git a/types.hpp b/types.hpp index 5dd23e56..7a82da4c 100644 --- a/types.hpp +++ b/types.hpp @@ -75,7 +75,8 @@ struct sized_type : public bits_type template -std::string type_to_string (void); +std::string +type_to_string (void); namespace detail { @@ -142,6 +143,7 @@ template size_t elems(T (&)[N]) { return N; } + template std::unique_ptr make_unique(Args&&... args) { return std::unique_ptr (new T(std::forward(args)...)); @@ -161,6 +163,25 @@ struct fourcc { std::ostream& operator<< (std::ostream&, fourcc); +template struct is_dereferencable : std::false_type { }; +template struct is_dereferencable : std::true_type { }; +template struct is_dereferencable> : std::true_type { }; +template struct is_dereferencable> : std::true_type { }; +template struct is_dereferencable> : std::true_type { }; +template struct is_dereferencable> : std::true_type { }; + + +template struct dereferenced_type { + typedef typename std::enable_if< + std::is_pointer::value, + std::remove_pointer + >::type type; +}; + +template struct dereferenced_type> { typedef T type; }; +template struct dereferenced_type> { typedef T type; }; +template struct dereferenced_type> { typedef T type; }; +template struct dereferenced_type> { typedef T type; }; #endif // __TYPES_HPP