Mercurial > mm7
annotate NZIArray.h @ 1892:9995cbcc62e0
Actor::GetActorsRelation finishing cleanup
author | Grumpy7 |
---|---|
date | Sun, 20 Oct 2013 00:21:16 -0700 |
parents | f8414042db1f |
children |
rev | line source |
---|---|
1708
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
1 #pragma once |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
2 #include <array> |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
3 #include <assert.h> |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
4 |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
5 |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
6 template<class _Ty, |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
7 size_t _Size> |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
8 class NZIArray : std::array<_Ty, _Size> |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
9 { |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
10 public: |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
11 reference ZerothIndex() |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
12 { |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
13 return std::array<_Ty, _Size>::operator [](0); |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
14 } |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
15 |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
16 reference operator[](size_type _Pos) |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
17 { // subscript nonmutable sequence |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
18 #if _ITERATOR_DEBUG_LEVEL == 2 |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
19 assert(_Pos != 0 && "not allowed to access zeroth element"); |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
20 |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
21 #elif _ITERATOR_DEBUG_LEVEL == 1 |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
22 _SCL_SECURE_VALIDATE_RANGE(_Pos != 0); |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
23 #endif /* _ITERATOR_DEBUG_LEVEL */ |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
24 |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
25 __analysis_assume(_Pos != 0); |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
26 |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
27 return std::array<_Ty, _Size>::operator [](_Pos); |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
28 } |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
29 |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
30 const_reference operator[](size_type _Pos) const |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
31 { // subscript nonmutable sequence |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
32 #if _ITERATOR_DEBUG_LEVEL == 2 |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
33 assert(_Pos != 0 && "not allowed to access zeroth element"); |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
34 |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
35 #elif _ITERATOR_DEBUG_LEVEL == 1 |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
36 _SCL_SECURE_VALIDATE_RANGE(_Pos != 0); |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
37 #endif /* _ITERATOR_DEBUG_LEVEL */ |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
38 |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
39 __analysis_assume(_Pos != 0); |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
40 |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
41 return std::array<_Ty, _Size>::operator [](_Pos); |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
42 } |
f8414042db1f
Moving NZIArray to a separate class, fixing a few inventory bugs
Grumpy7
parents:
diff
changeset
|
43 }; |