@@ -109,6 +109,44 @@ rend() const {
109
109
return _vector.rend ();
110
110
}
111
111
112
+ /* *
113
+ * Returns the iterator that marks the first element in the ordered vector.
114
+ */
115
+ template <class Key , class Compare , class Vector >
116
+ INLINE TYPENAME ordered_vector<Key, Compare, Vector>::CONST_ITERATOR ordered_vector<Key, Compare, Vector>::
117
+ cbegin () const {
118
+ return _vector.begin ();
119
+ }
120
+
121
+ /* *
122
+ * Returns the iterator that marks the end of the ordered vector.
123
+ */
124
+ template <class Key , class Compare , class Vector >
125
+ INLINE TYPENAME ordered_vector<Key, Compare, Vector>::CONST_ITERATOR ordered_vector<Key, Compare, Vector>::
126
+ cend () const {
127
+ return _vector.end ();
128
+ }
129
+
130
+ /* *
131
+ * Returns the iterator that marks the first element in the ordered vector,
132
+ * when viewed in reverse order.
133
+ */
134
+ template <class Key , class Compare , class Vector >
135
+ INLINE TYPENAME ordered_vector<Key, Compare, Vector>::CONST_REVERSE_ITERATOR ordered_vector<Key, Compare, Vector>::
136
+ crbegin () const {
137
+ return _vector.rbegin ();
138
+ }
139
+
140
+ /* *
141
+ * Returns the iterator that marks the end of the ordered vector, when viewed
142
+ * in reverse order.
143
+ */
144
+ template <class Key , class Compare , class Vector >
145
+ INLINE TYPENAME ordered_vector<Key, Compare, Vector>::CONST_REVERSE_ITERATOR ordered_vector<Key, Compare, Vector>::
146
+ crend () const {
147
+ return _vector.rend ();
148
+ }
149
+
112
150
/* *
113
151
* Returns the nth element.
114
152
*/
@@ -127,6 +165,54 @@ operator [] (TYPENAME ordered_vector<Key, Compare, Vector>::SIZE_TYPE n) const {
127
165
return _vector[n];
128
166
}
129
167
168
+ /* *
169
+ * Returns a reference to the first element.
170
+ */
171
+ template <class Key , class Compare , class Vector >
172
+ INLINE TYPENAME ordered_vector<Key, Compare, Vector>::REFERENCE ordered_vector<Key, Compare, Vector>::
173
+ front () {
174
+ #ifdef _DEBUG
175
+ assert (!_vector.empty ());
176
+ #endif
177
+ return _vector[0 ];
178
+ }
179
+
180
+ /* *
181
+ * Returns a const reference to the first element.
182
+ */
183
+ template <class Key , class Compare , class Vector >
184
+ INLINE TYPENAME ordered_vector<Key, Compare, Vector>::CONST_REFERENCE ordered_vector<Key, Compare, Vector>::
185
+ front () const {
186
+ #ifdef _DEBUG
187
+ assert (!_vector.empty ());
188
+ #endif
189
+ return _vector[0 ];
190
+ }
191
+
192
+ /* *
193
+ * Returns a reference to the first element.
194
+ */
195
+ template <class Key , class Compare , class Vector >
196
+ INLINE TYPENAME ordered_vector<Key, Compare, Vector>::REFERENCE ordered_vector<Key, Compare, Vector>::
197
+ back () {
198
+ #ifdef _DEBUG
199
+ assert (!_vector.empty ());
200
+ #endif
201
+ return _vector[_vector.size () - 1 ];
202
+ }
203
+
204
+ /* *
205
+ * Returns a const reference to the last element.
206
+ */
207
+ template <class Key , class Compare , class Vector >
208
+ INLINE TYPENAME ordered_vector<Key, Compare, Vector>::CONST_REFERENCE ordered_vector<Key, Compare, Vector>::
209
+ back () const {
210
+ #ifdef _DEBUG
211
+ assert (!_vector.empty ());
212
+ #endif
213
+ return _vector[_vector.size () - 1 ];
214
+ }
215
+
130
216
/* *
131
217
* Returns the number of elements in the ordered vector.
132
218
*/
@@ -530,6 +616,18 @@ push_back(const value_type &key) {
530
616
_vector.push_back (key);
531
617
}
532
618
619
+ /* *
620
+ * Adds the new element to the end of the vector without regard for proper
621
+ * sorting. This is a bad idea to do except to populate the vector the first
622
+ * time; be sure to call sort() after you have added all the elements.
623
+ */
624
+ template <class Key , class Compare , class Vector >
625
+ INLINE void ordered_vector<Key, Compare, Vector>::
626
+ push_back (value_type &&key) {
627
+ TAU_PROFILE (" ordered_vector::push_back()" , " " , TAU_USER);
628
+ _vector.push_back (move (key));
629
+ }
630
+
533
631
/* *
534
632
* Removes the last element at the end of the vector.
535
633
*/
0 commit comments