MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / array

Class array

3rd/wildcards/include/cx/array.hpp:19–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17
18template <typename T, std::size_t N>
19struct array
20{
21 using value_type = T;
22
23 constexpr std::size_t size() const
24 {
25 return N;
26 }
27
28 constexpr bool empty() const
29 {
30 return size() == 0;
31 }
32
33 constexpr const T* begin() const
34 {
35 return &data[0];
36 }
37
38 cfg_constexpr14 T* begin()
39 {
40 return &data[0];
41 }
42
43 constexpr const T* cbegin() const
44 {
45 return begin();
46 }
47
48 constexpr const T* end() const
49 {
50 return &data[N];
51 }
52
53 cfg_constexpr14 T* end()
54 {
55 return &data[N];
56 }
57
58 constexpr const T* cend() const
59 {
60 return end();
61 }
62
63 constexpr const T& operator[](std::size_t pos) const
64 {
65 return data[pos];
66 }
67
68 cfg_constexpr14 T& operator[](std::size_t pos)
69 {
70 return data[pos];
71 }
72
73 constexpr const T& at(std::size_t pos) const
74 {
75 return pos < size() ? data[pos] : throw std::out_of_range("The given position is out of range");
76 }

Callers 3

CheckSingleFileMethod · 0.50
SerializeMethod · 0.50
SerializeArrayMethod · 0.50

Calls 2

sizeFunction · 0.70
out_of_rangeClass · 0.50

Tested by

no test coverage detected