SDXFrameWork 0.09 SDXFrameWork

- Main Page
- Related Pages
- Classes

All Classes Namespaces Functions Variables Enumerations Enumerator Pages
EnumArray.h
1 #pragma once//©SDXFramework http://sourceforge.jp/projects/dxframework/
2 #include <array>
3
4 namespace SDX
5 {
8 template <class TData, class TType>
9 class EnumArray
10 {
11 private:
12 std::array<TData, (int)TType::COUNT> Array;
13 public:
14 size_t size() const
15 {
16 return Array.size();
17 }
18
19 TData& operator[](const TType index)
20 {
21 return Array[(int)index];
22 }
23
24 const TData& operator[](const TType index) const
25 {
26 return Array[(int)index];
27 }
28
29 auto begin() ->decltype(Array.begin())
30 {
31 return Array.begin();
32 }
33
34 auto end() ->decltype(Array.end())
35 {
36 return Array.end();
37 }
38
39 auto begin() const ->decltype(Array.begin())
40 {
41 return Array.begin();
42 }
43
44 auto end() const ->decltype(Array.end())
45 {
46 return Array.end();
47 }
48
49 };
50 }
SDX::EnumArray
列挙型を直接添字に使える配列.
Definition: EnumArray.h:9