OSVR-Core  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
TypeKeyedTuple.h
Go to the documentation of this file.
1 
11 // Copyright 2015 Sensics, Inc.
12 // TypePack is part of OSVR-Core.
13 //
14 // Use, modification and distribution is subject to the
15 // Boost Software License, Version 1.0. (See accompanying
16 // file LICENSE_1_0.txt or copy at
17 // http://www.boost.org/LICENSE_1_0.txt)
18 
19 #ifndef INCLUDED_TypeKeyedTuple_h_GUID_04E79266_BD2F_458D_B7AC_DF5F35CC6EC4
20 #define INCLUDED_TypeKeyedTuple_h_GUID_04E79266_BD2F_458D_B7AC_DF5F35CC6EC4
21 
22 // Internal Includes
23 #include "TypeKeyed.h"
24 #include "Apply.h"
25 #include "Transform.h"
26 #include "ApplyList.h"
27 
28 // Library/third-party includes
29 // - none
30 
31 // Standard includes
32 #include <tuple>
33 
34 namespace osvr {
35 namespace typepack {
47  template <typename KeyList, typename ComputeValueTypes>
49  : public TypeKeyedBase<TypeKeyedTuple<KeyList, ComputeValueTypes>> {
50  using value_types = transform<KeyList, ComputeValueTypes>;
51 
52  public:
53  using key_types = KeyList;
54 
55  using container_type = apply_list<quote<std::tuple>, value_types>;
56 
57  private:
58  template <typename, typename>
59  friend struct typekeyed_detail::ValueAccessor;
60 
62  container_type &nested_container() { return container_; }
64  container_type const &nested_container() const { return container_; }
65 
66  private:
67  container_type container_;
68  };
69 
70  // Required traits
71  namespace typekeyed_detail {
72  template <typename KeyList, typename ComputeValueTypes, typename Key>
73  struct ValueTypeAtKeyTraits<TypeKeyedTuple<KeyList, ComputeValueTypes>,
74  Key> {
75  using type = apply<ComputeValueTypes, Key>;
76  };
77  } // namespace typekeyed_detail
78 
79 } // namespace typepack
80 } // namespace osvr
81 
82 #endif // INCLUDED_TypeKeyedTuple_h_GUID_04E79266_BD2F_458D_B7AC_DF5F35CC6EC4
Header.
The main namespace for all C++ elements of the framework, internal and external.
Definition: ClientKit.h:31
Provides a data structure where a value of heterogeneous data types may be stored at runtime for each...
Header.
typename F::template apply< Args...> apply
Apply an alias class.
Definition: Apply.h:44
t_< detail::transform_< List, Fun >> transform
Definition: Transform.h:54
Header.
apply< detail::apply_list_< F, Args >> apply_list
Apply an alias class, exploding the list of args.
Definition: ApplyList.h:56
Header.