mirror of https://github.com/axmolengine/axmol.git
Vector iterator declaration & initializer list constructor
* Vector iterator typedef -> alias declaration * Vector constructor with initializer list * fix indent
This commit is contained in:
parent
107cef0667
commit
7f2b0edc04
|
@ -53,14 +53,14 @@ public:
|
||||||
// ------------------------------------------
|
// ------------------------------------------
|
||||||
|
|
||||||
/** Iterator, can be used to loop the Vector. */
|
/** Iterator, can be used to loop the Vector. */
|
||||||
typedef typename std::vector<T>::iterator iterator;
|
using iterator = typename std::vector<T>::iterator;
|
||||||
/** Const iterator, can be used to loop the Vector. */
|
/** Const iterator, can be used to loop the Vector. */
|
||||||
typedef typename std::vector<T>::const_iterator const_iterator;
|
using const_iterator = typename std::vector<T>::const_iterator;
|
||||||
|
|
||||||
/** Reversed iterator, can be used to loop the Vector in reverse sequence. */
|
/** Reversed iterator, can be used to loop the Vector in reverse sequence. */
|
||||||
typedef typename std::vector<T>::reverse_iterator reverse_iterator;
|
using reverse_iterator = typename std::vector<T>::reverse_iterator;
|
||||||
/** Reversed iterator, can be used to loop the Vector in reverse sequence. */
|
/** Reversed iterator, can be used to loop the Vector in reverse sequence. */
|
||||||
typedef typename std::vector<T>::const_reverse_iterator const_reverse_iterator;
|
using const_reverse_iterator = typename std::vector<T>::const_reverse_iterator;
|
||||||
|
|
||||||
/** Returns an iterator pointing the first element of the Vector. */
|
/** Returns an iterator pointing the first element of the Vector. */
|
||||||
iterator begin() { return _data.begin(); }
|
iterator begin() { return _data.begin(); }
|
||||||
|
@ -125,6 +125,15 @@ public:
|
||||||
reserve(capacity);
|
reserve(capacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Constructor with initializer list. */
|
||||||
|
Vector<T>(std::initializer_list<T> list)
|
||||||
|
{
|
||||||
|
for (auto& element : list)
|
||||||
|
{
|
||||||
|
pushBack(element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Destructor. */
|
/** Destructor. */
|
||||||
~Vector<T>()
|
~Vector<T>()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue