Browse Source

add insert_unverified

David Rose 19 years ago
parent
commit
9ed9038098
2 changed files with 19 additions and 1 deletions
  1. 18 1
      panda/src/express/ordered_vector.I
  2. 1 0
      panda/src/express/ordered_vector.h

+ 18 - 1
panda/src/express/ordered_vector.I

@@ -337,7 +337,7 @@ insert_unique(const TYPENAME ordered_vector<Key, Compare>::VALUE_TYPE &key) {
 //               the appropriate place.  If there are already elements
 //               sorting equivalent to the key in the vector, the new
 //               value is inserted following them.  
-
+//
 //               The return value is the iterator referencing the new
 //               element.
 ////////////////////////////////////////////////////////////////////
@@ -353,6 +353,23 @@ insert_nonunique(const TYPENAME ordered_vector<Key, Compare>::VALUE_TYPE &key) {
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: ordered_vector::insert_unverified
+//       Access: Public
+//  Description: Inserts the indicated key into the ordered vector at
+//               the indicated place.  The user is trusted to have
+//               already verified that this is the correct sorting
+//               position; no checks are made.
+////////////////////////////////////////////////////////////////////
+template<class Key, class Compare>
+INLINE TYPENAME ordered_vector<Key, Compare>::ITERATOR ordered_vector<Key, Compare>::
+insert_unverified(TYPENAME ordered_vector<Key, Compare>::ITERATOR position, 
+                  const TYPENAME ordered_vector<Key, Compare>::VALUE_TYPE &key) {
+  TAU_PROFILE("ordered_vector::insert_unverified(iterator, const value_type &)", " ", TAU_USER);
+  ITERATOR result = _vector.insert(position, key);
+  return result;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: ordered_vector::erase, with iterator
 //       Access: Public

+ 1 - 0
panda/src/express/ordered_vector.h

@@ -192,6 +192,7 @@ public:
   ITERATOR insert_nonunique(ITERATOR position, const VALUE_TYPE &key);
   INLINE pair<ITERATOR, bool> insert_unique(const VALUE_TYPE &key);
   INLINE ITERATOR insert_nonunique(const VALUE_TYPE &key);
+  INLINE ITERATOR insert_unverified(ITERATOR position, const VALUE_TYPE &key);
 
   // Erase operations.
   INLINE ITERATOR erase(ITERATOR position);