|
|
@@ -109,6 +109,44 @@ rend() const {
|
|
|
return _vector.rend();
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * Returns the iterator that marks the first element in the ordered vector.
|
|
|
+ */
|
|
|
+template<class Key, class Compare, class Vector>
|
|
|
+INLINE TYPENAME ordered_vector<Key, Compare, Vector>::CONST_ITERATOR ordered_vector<Key, Compare, Vector>::
|
|
|
+cbegin() const {
|
|
|
+ return _vector.begin();
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * Returns the iterator that marks the end of the ordered vector.
|
|
|
+ */
|
|
|
+template<class Key, class Compare, class Vector>
|
|
|
+INLINE TYPENAME ordered_vector<Key, Compare, Vector>::CONST_ITERATOR ordered_vector<Key, Compare, Vector>::
|
|
|
+cend() const {
|
|
|
+ return _vector.end();
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * Returns the iterator that marks the first element in the ordered vector,
|
|
|
+ * when viewed in reverse order.
|
|
|
+ */
|
|
|
+template<class Key, class Compare, class Vector>
|
|
|
+INLINE TYPENAME ordered_vector<Key, Compare, Vector>::CONST_REVERSE_ITERATOR ordered_vector<Key, Compare, Vector>::
|
|
|
+crbegin() const {
|
|
|
+ return _vector.rbegin();
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * Returns the iterator that marks the end of the ordered vector, when viewed
|
|
|
+ * in reverse order.
|
|
|
+ */
|
|
|
+template<class Key, class Compare, class Vector>
|
|
|
+INLINE TYPENAME ordered_vector<Key, Compare, Vector>::CONST_REVERSE_ITERATOR ordered_vector<Key, Compare, Vector>::
|
|
|
+crend() const {
|
|
|
+ return _vector.rend();
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* Returns the nth element.
|
|
|
*/
|
|
|
@@ -127,6 +165,54 @@ operator [] (TYPENAME ordered_vector<Key, Compare, Vector>::SIZE_TYPE n) const {
|
|
|
return _vector[n];
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * Returns a reference to the first element.
|
|
|
+ */
|
|
|
+template<class Key, class Compare, class Vector>
|
|
|
+INLINE TYPENAME ordered_vector<Key, Compare, Vector>::REFERENCE ordered_vector<Key, Compare, Vector>::
|
|
|
+front() {
|
|
|
+#ifdef _DEBUG
|
|
|
+ assert(!_vector.empty());
|
|
|
+#endif
|
|
|
+ return _vector[0];
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * Returns a const reference to the first element.
|
|
|
+ */
|
|
|
+template<class Key, class Compare, class Vector>
|
|
|
+INLINE TYPENAME ordered_vector<Key, Compare, Vector>::CONST_REFERENCE ordered_vector<Key, Compare, Vector>::
|
|
|
+front() const {
|
|
|
+#ifdef _DEBUG
|
|
|
+ assert(!_vector.empty());
|
|
|
+#endif
|
|
|
+ return _vector[0];
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * Returns a reference to the first element.
|
|
|
+ */
|
|
|
+template<class Key, class Compare, class Vector>
|
|
|
+INLINE TYPENAME ordered_vector<Key, Compare, Vector>::REFERENCE ordered_vector<Key, Compare, Vector>::
|
|
|
+back() {
|
|
|
+#ifdef _DEBUG
|
|
|
+ assert(!_vector.empty());
|
|
|
+#endif
|
|
|
+ return _vector[_vector.size() - 1];
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * Returns a const reference to the last element.
|
|
|
+ */
|
|
|
+template<class Key, class Compare, class Vector>
|
|
|
+INLINE TYPENAME ordered_vector<Key, Compare, Vector>::CONST_REFERENCE ordered_vector<Key, Compare, Vector>::
|
|
|
+back() const {
|
|
|
+#ifdef _DEBUG
|
|
|
+ assert(!_vector.empty());
|
|
|
+#endif
|
|
|
+ return _vector[_vector.size() - 1];
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* Returns the number of elements in the ordered vector.
|
|
|
*/
|
|
|
@@ -530,6 +616,18 @@ push_back(const value_type &key) {
|
|
|
_vector.push_back(key);
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * Adds the new element to the end of the vector without regard for proper
|
|
|
+ * sorting. This is a bad idea to do except to populate the vector the first
|
|
|
+ * time; be sure to call sort() after you have added all the elements.
|
|
|
+ */
|
|
|
+template<class Key, class Compare, class Vector>
|
|
|
+INLINE void ordered_vector<Key, Compare, Vector>::
|
|
|
+push_back(value_type &&key) {
|
|
|
+ TAU_PROFILE("ordered_vector::push_back()", " ", TAU_USER);
|
|
|
+ _vector.push_back(move(key));
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* Removes the last element at the end of the vector.
|
|
|
*/
|