OSVR-Core
HasType.h
Go to the documentation of this file.
1 
14 // Copyright 2015 Sensics, Inc.
15 // TypePack is part of OSVR-Core.
16 //
17 // Incorporates code from "meta":
18 // Copyright Eric Niebler 2014-2015
19 //
20 // Use, modification and distribution is subject to the
21 // Boost Software License, Version 1.0. (See accompanying
22 // file LICENSE_1_0.txt or copy at
23 // http://www.boost.org/LICENSE_1_0.txt)
24 //
25 // Project home: https://github.com/ericniebler/meta
26 //
27 
28 #ifndef INCLUDED_HasType_h_GUID_C99B75F2_4F44_49BD_6152_3CF9B0B80DAB
29 #define INCLUDED_HasType_h_GUID_C99B75F2_4F44_49BD_6152_3CF9B0B80DAB
30 
31 // Internal Includes
32 #include "Void.h"
33 
34 // Library/third-party includes
35 // - none
36 
37 // Standard includes
38 #include <type_traits>
39 
40 namespace osvr {
41 namespace typepack {
43  namespace detail {
44  template <typename, typename = void> struct has_type_ {
45  using type = std::false_type;
46  };
47 
48  template <typename T> struct has_type_<T, void_<typename T::type>> {
49  using type = std::true_type;
50  };
51 
52  } // namespace detail
54 
57  template <typename T> using has_type = t_<detail::has_type_<T>>;
58 } // namespace typepack
59 } // namespace osvr
60 
61 #endif // INCLUDED_HasType_h_GUID_C99B75F2_4F44_49BD_6152_3CF9B0B80DAB
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
apply< always< void >, Ts... > void_
An alias for void.
Definition: Void.h:45
Definition: newuoa.h:1888
t_< detail::has_type_< T >> has_type
An alias for std::true_type if T::type exists and names a type; otherwise, it&#39;s an alias for std::fal...
Definition: HasType.h:57
A small structure to hold a non zero as a triplet (i,j,value).
Definition: SparseUtil.h:148
typename T::type t_
A convenience alias template to extract the nested type within the supplied T.
Definition: T.h:52
Header.