зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1127045 part 3 - Make nsTArray support reverse iterating. r=froydnj
--HG-- extra : source : 6cd8187de27872308575077e6b4ba4d6df1fc312
This commit is contained in:
Родитель
aeda889bb9
Коммит
f303a6cca2
|
@ -14,6 +14,7 @@
|
|||
#include "mozilla/MathAlgorithms.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/Move.h"
|
||||
#include "mozilla/ReverseIterator.h"
|
||||
#include "mozilla/TypeTraits.h"
|
||||
|
||||
#include <string.h>
|
||||
|
@ -770,6 +771,8 @@ public:
|
|||
typedef nsTArray_SafeElementAtHelper<E, self_type> safeelementat_helper_type;
|
||||
typedef elem_type* iterator;
|
||||
typedef const elem_type* const_iterator;
|
||||
typedef mozilla::ReverseIterator<elem_type*> reverse_iterator;
|
||||
typedef mozilla::ReverseIterator<const elem_type*> const_reverse_iterator;
|
||||
|
||||
using safeelementat_helper_type::SafeElementAt;
|
||||
using base_type::EmptyHdr;
|
||||
|
@ -1001,6 +1004,14 @@ public:
|
|||
const_iterator end() const { return Elements() + Length(); }
|
||||
const_iterator cend() const { return end(); }
|
||||
|
||||
// Methods for reverse iterating.
|
||||
reverse_iterator rbegin() { return reverse_iterator(end()); }
|
||||
const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
|
||||
const_reverse_iterator crbegin() const { return rbegin(); }
|
||||
reverse_iterator rend() { return reverse_iterator(begin()); }
|
||||
const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
|
||||
const_reverse_iterator crend() const { return rend(); }
|
||||
|
||||
//
|
||||
// Search methods
|
||||
//
|
||||
|
|
Загрузка…
Ссылка в новой задаче