src/types.h

changeset 293
a0ed563e14b2
parent 290
be0c367e7420
child 297
2cbd8ac8293b
equal deleted inserted replaced
292:4779ca562d5e 293:a0ed563e14b2
50 typedef uint16_t uint16; 50 typedef uint16_t uint16;
51 typedef uint32_t uint32; 51 typedef uint32_t uint32;
52 typedef uint64_t uint64; 52 typedef uint64_t uint64;
53 53
54 template<class T> using initlist = std::initializer_list<T>; 54 template<class T> using initlist = std::initializer_list<T>;
55 template<class T, class R> using pair = std::pair<T, R>;
55 using std::size_t; 56 using std::size_t;
56 57
57 enum Axis { X, Y, Z }; 58 enum Axis { X, Y, Z };
58 static const Axis g_Axes[3] = { X, Y, Z }; 59 static const Axis g_Axes[3] = { X, Y, Z };
59 60
185 void erase (ulong pos) { 186 void erase (ulong pos) {
186 assert (pos < size ()); 187 assert (pos < size ());
187 m_vect.erase (m_vect.begin () + pos); 188 m_vect.erase (m_vect.begin () + pos);
188 } 189 }
189 190
190 void push_back (const T& value) { 191 T& push_back (const T& value) {
191 m_vect.push_back (value); 192 m_vect.push_back (value);
193 return m_vect[m_vect.size () - 1];
192 } 194 }
193 195
194 void push_back (const vector<T>& vals) { 196 void push_back (const vector<T>& vals) {
195 for (const T& val : vals) 197 for (const T& val : vals)
196 push_back (val); 198 push_back (val);
203 val = m_vect[size () - 1]; 205 val = m_vect[size () - 1];
204 erase (size () - 1); 206 erase (size () - 1);
205 return true; 207 return true;
206 } 208 }
207 209
208 vector<T>& operator<< (const T& value) { 210 T& operator<< (const T& value) {
209 push_back (value); 211 return push_back (value);
210 return *this; 212 }
211 } 213
212 214 void operator<< (const vector<T>& vals) {
213 vector<T>& operator<< (const vector<T>& vals) {
214 push_back (vals); 215 push_back (vals);
215 return *this;
216 } 216 }
217 217
218 bool operator>> (T& value) { 218 bool operator>> (T& value) {
219 return pop (value); 219 return pop (value);
220 } 220 }

mercurial