OSVR-Core
TypeKeyedMap.h
Go to the documentation of this file.
1 
12 // Copyright 2015 Sensics, Inc.
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 // Project home: https://github.com/ericniebler/meta
20 //
21 
22 #ifndef INCLUDED_TypeKeyedMap_h_GUID_29C6B905_4493_43AF_A811_71589CFD6FBC
23 #define INCLUDED_TypeKeyedMap_h_GUID_29C6B905_4493_43AF_A811_71589CFD6FBC
24 
25 // Internal Includes
26 #include "TypeKeyed.h"
27 #include "Contains.h"
28 #include "Length.h"
29 
30 // Library/third-party includes
31 // - none
32 
33 // Standard includes
34 #include <array>
35 
36 namespace osvr {
37 namespace typepack {
48  template <typename KeyList, typename ValueType>
50  : public TypeKeyedBase<TypeKeyedMap<KeyList, ValueType>> {
52 
53  public:
54  using key_types = KeyList;
55  using value_type = ValueType;
56 
57  private:
58  template <typename, typename>
59  friend struct typekeyed_detail::ValueAccessor;
60  using container_type = std::array<value_type, size_constant::value>;
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 ValueType, typename Key>
73  struct ValueTypeAtKeyTraits<TypeKeyedMap<KeyList, ValueType>, Key> {
74  using type = ValueType;
75  };
76 
77  } // namespace typekeyed_detail
78 } // namespace typepack
79 } // namespace osvr
80 
81 #endif // INCLUDED_TypeKeyedMap_h_GUID_29C6B905_4493_43AF_A811_71589CFD6FBC
Header.
Class with static members performing the actual access.
Definition: TypeKeyed.h:102
CRTP base for type-keyed data types, providing a unified interface (compile-time polymorphism) and sh...
Definition: TypeKeyed.h:37
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
traits class that MUST be specialized for each type-keyed container: should contain a using type = de...
Definition: TypeKeyed.h:44
A class that uses types as an index into a container with uniform-typed contents, somewhat like a map...
Definition: TypeKeyedMap.h:49
Definition: Size.h:43
Header.
Header.