mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-05 11:28:17 -04:00
more compiler support hacks
This commit is contained in:
parent
3c5ad231b6
commit
d83cc1a60b
@ -72,7 +72,7 @@ INLINE ordered_vector<Key, Compare>::
|
|||||||
// the ordered vector.
|
// the ordered vector.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::iterator ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::ITERATOR ordered_vector<Key, Compare>::
|
||||||
begin() {
|
begin() {
|
||||||
return _vector.begin();
|
return _vector.begin();
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ begin() {
|
|||||||
// ordered vector.
|
// ordered vector.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::iterator ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::ITERATOR ordered_vector<Key, Compare>::
|
||||||
end() {
|
end() {
|
||||||
return _vector.end();
|
return _vector.end();
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ end() {
|
|||||||
// the ordered vector, when viewed in reverse order.
|
// the ordered vector, when viewed in reverse order.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::reverse_iterator ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::REVERSE_ITERATOR ordered_vector<Key, Compare>::
|
||||||
rbegin() {
|
rbegin() {
|
||||||
return _vector.rbegin();
|
return _vector.rbegin();
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ rbegin() {
|
|||||||
// ordered vector, when viewed in reverse order.
|
// ordered vector, when viewed in reverse order.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::reverse_iterator ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::REVERSE_ITERATOR ordered_vector<Key, Compare>::
|
||||||
rend() {
|
rend() {
|
||||||
return _vector.rend();
|
return _vector.rend();
|
||||||
}
|
}
|
||||||
@ -120,7 +120,7 @@ rend() {
|
|||||||
// the ordered vector.
|
// the ordered vector.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::const_iterator ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::CONST_ITERATOR ordered_vector<Key, Compare>::
|
||||||
begin() const {
|
begin() const {
|
||||||
return _vector.begin();
|
return _vector.begin();
|
||||||
}
|
}
|
||||||
@ -132,7 +132,7 @@ begin() const {
|
|||||||
// ordered vector.
|
// ordered vector.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::const_iterator ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::CONST_ITERATOR ordered_vector<Key, Compare>::
|
||||||
end() const {
|
end() const {
|
||||||
return _vector.end();
|
return _vector.end();
|
||||||
}
|
}
|
||||||
@ -144,7 +144,7 @@ end() const {
|
|||||||
// the ordered vector, when viewed in reverse order.
|
// the ordered vector, when viewed in reverse order.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::const_reverse_iterator ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::CONST_REVERSE_ITERATOR ordered_vector<Key, Compare>::
|
||||||
rbegin() const {
|
rbegin() const {
|
||||||
return _vector.rbegin();
|
return _vector.rbegin();
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@ rbegin() const {
|
|||||||
// ordered vector, when viewed in reverse order.
|
// ordered vector, when viewed in reverse order.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::const_reverse_iterator ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::CONST_REVERSE_ITERATOR ordered_vector<Key, Compare>::
|
||||||
rend() const {
|
rend() const {
|
||||||
return _vector.rend();
|
return _vector.rend();
|
||||||
}
|
}
|
||||||
@ -167,8 +167,8 @@ rend() const {
|
|||||||
// Description: Returns the nth element.
|
// Description: Returns the nth element.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::reference ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::REFERENCE ordered_vector<Key, Compare>::
|
||||||
operator [] (ordered_vector<Key, Compare>::size_type n) {
|
operator [] (ordered_vector<Key, Compare>::SIZE_TYPE n) {
|
||||||
return _vector[n];
|
return _vector[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,8 +178,8 @@ operator [] (ordered_vector<Key, Compare>::size_type n) {
|
|||||||
// Description: Returns the nth element.
|
// Description: Returns the nth element.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::const_reference ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::CONST_REFERENCE ordered_vector<Key, Compare>::
|
||||||
operator [] (ordered_vector<Key, Compare>::size_type n) const {
|
operator [] (ordered_vector<Key, Compare>::SIZE_TYPE n) const {
|
||||||
return _vector[n];
|
return _vector[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ operator [] (ordered_vector<Key, Compare>::size_type n) const {
|
|||||||
// Description: Returns the number of elements in the ordered vector.
|
// Description: Returns the number of elements in the ordered vector.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::size_type ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::SIZE_TYPE ordered_vector<Key, Compare>::
|
||||||
size() const {
|
size() const {
|
||||||
return _vector.size();
|
return _vector.size();
|
||||||
}
|
}
|
||||||
@ -201,7 +201,7 @@ size() const {
|
|||||||
// possibly be stored in an ordered vector.
|
// possibly be stored in an ordered vector.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::size_type ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::SIZE_TYPE ordered_vector<Key, Compare>::
|
||||||
max_size() const {
|
max_size() const {
|
||||||
return _vector.max_size();
|
return _vector.max_size();
|
||||||
}
|
}
|
||||||
@ -309,25 +309,25 @@ operator >= (const ordered_vector<Key, Compare> &other) const {
|
|||||||
// the insert operation has taken place.
|
// the insert operation has taken place.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE pair<ordered_vector<Key, Compare>::iterator, bool> ordered_vector<Key, Compare>::
|
INLINE pair<ordered_vector<Key, Compare>::ITERATOR, bool> ordered_vector<Key, Compare>::
|
||||||
insert_unique(const ordered_vector<Key, Compare>::value_type &key) {
|
insert_unique(const ordered_vector<Key, Compare>::VALUE_TYPE &key) {
|
||||||
iterator position = find_insert_position(begin(), end(), key);
|
ITERATOR position = find_insert_position(begin(), end(), key);
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
pair<iterator, bool> bogus_result(end(), false);
|
pair<ITERATOR, bool> bogus_result(end(), false);
|
||||||
nassertr(position >= begin() && position <= end(), bogus_result);
|
nassertr(position >= begin() && position <= end(), bogus_result);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// If there's already an equivalent key in the vector, it's at
|
// If there's already an equivalent key in the vector, it's at
|
||||||
// *(position - 1).
|
// *(position - 1).
|
||||||
if (position != begin() && !_compare(*(position - 1), key)) {
|
if (position != begin() && !_compare(*(position - 1), key)) {
|
||||||
pair<iterator, bool> result(position - 1, false);
|
pair<ITERATOR, bool> result(position - 1, false);
|
||||||
nassertr(!_compare(key, *(position - 1)), result);
|
nassertr(!_compare(key, *(position - 1)), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator result = _vector.insert(position, key);
|
ITERATOR result = _vector.insert(position, key);
|
||||||
verify_list();
|
verify_list();
|
||||||
return pair<iterator, bool>(result, true);
|
return pair<ITERATOR, bool>(result, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -342,12 +342,12 @@ insert_unique(const ordered_vector<Key, Compare>::value_type &key) {
|
|||||||
// element.
|
// element.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::iterator ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::ITERATOR ordered_vector<Key, Compare>::
|
||||||
insert_nonunique(const ordered_vector<Key, Compare>::value_type &key) {
|
insert_nonunique(const ordered_vector<Key, Compare>::VALUE_TYPE &key) {
|
||||||
iterator position = find_insert_position(begin(), end(), key);
|
ITERATOR position = find_insert_position(begin(), end(), key);
|
||||||
nassertr(position >= begin() && position <= end(), end());
|
nassertr(position >= begin() && position <= end(), end());
|
||||||
|
|
||||||
iterator result = _vector.insert(position, key);
|
ITERATOR result = _vector.insert(position, key);
|
||||||
verify_list();
|
verify_list();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -360,9 +360,9 @@ insert_nonunique(const ordered_vector<Key, Compare>::value_type &key) {
|
|||||||
// and returns the next sequential iterator.
|
// and returns the next sequential iterator.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::iterator ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::ITERATOR ordered_vector<Key, Compare>::
|
||||||
erase(ordered_vector<Key, Compare>::iterator position) {
|
erase(ordered_vector<Key, Compare>::ITERATOR position) {
|
||||||
size_type count = position - begin();
|
SIZE_TYPE count = position - begin();
|
||||||
_vector.erase(position);
|
_vector.erase(position);
|
||||||
return begin() + count;
|
return begin() + count;
|
||||||
}
|
}
|
||||||
@ -374,10 +374,10 @@ erase(ordered_vector<Key, Compare>::iterator position) {
|
|||||||
// returns the number of elements removed.
|
// returns the number of elements removed.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::size_type ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::SIZE_TYPE ordered_vector<Key, Compare>::
|
||||||
erase(const ordered_vector<Key, Compare>::key_type &key) {
|
erase(const ordered_vector<Key, Compare>::KEY_TYPE &key) {
|
||||||
pair<iterator, iterator> result = equal_range(key);
|
pair<ITERATOR, ITERATOR> result = equal_range(key);
|
||||||
size_type count = result.second - result.first;
|
SIZE_TYPE count = result.second - result.first;
|
||||||
erase(result.first, result.second);
|
erase(result.first, result.second);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
@ -390,8 +390,8 @@ erase(const ordered_vector<Key, Compare>::key_type &key) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE void ordered_vector<Key, Compare>::
|
INLINE void ordered_vector<Key, Compare>::
|
||||||
erase(ordered_vector<Key, Compare>::iterator first,
|
erase(ordered_vector<Key, Compare>::ITERATOR first,
|
||||||
ordered_vector<Key, Compare>::iterator last) {
|
ordered_vector<Key, Compare>::ITERATOR last) {
|
||||||
_vector.erase(first, last);
|
_vector.erase(first, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,8 +415,8 @@ clear() {
|
|||||||
// key, the particular iterator returned is not defined.
|
// key, the particular iterator returned is not defined.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::iterator ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::ITERATOR ordered_vector<Key, Compare>::
|
||||||
find(const ordered_vector<Key, Compare>::key_type &key) {
|
find(const ordered_vector<Key, Compare>::KEY_TYPE &key) {
|
||||||
return nci(r_find(begin(), end(), end(), key));
|
return nci(r_find(begin(), end(), end(), key));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,8 +429,8 @@ find(const ordered_vector<Key, Compare>::key_type &key) {
|
|||||||
// key, the particular iterator returned is not defined.
|
// key, the particular iterator returned is not defined.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::const_iterator ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::CONST_ITERATOR ordered_vector<Key, Compare>::
|
||||||
find(const ordered_vector<Key, Compare>::key_type &key) const {
|
find(const ordered_vector<Key, Compare>::KEY_TYPE &key) const {
|
||||||
return r_find(begin(), end(), end(), key);
|
return r_find(begin(), end(), end(), key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,8 +451,8 @@ find(const ordered_vector<Key, Compare>::key_type &key) const {
|
|||||||
// !Compare(b, a), but not necessarily the converse.
|
// !Compare(b, a), but not necessarily the converse.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::iterator ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::ITERATOR ordered_vector<Key, Compare>::
|
||||||
find_particular(const ordered_vector<Key, Compare>::key_type &key) {
|
find_particular(const ordered_vector<Key, Compare>::KEY_TYPE &key) {
|
||||||
return nci(r_find_particular(begin(), end(), end(), key));
|
return nci(r_find_particular(begin(), end(), end(), key));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,8 +470,8 @@ find_particular(const ordered_vector<Key, Compare>::key_type &key) {
|
|||||||
// particular iterator returned is not defined./
|
// particular iterator returned is not defined./
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::const_iterator ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::CONST_ITERATOR ordered_vector<Key, Compare>::
|
||||||
find_particular(const ordered_vector<Key, Compare>::key_type &key) const {
|
find_particular(const ordered_vector<Key, Compare>::KEY_TYPE &key) const {
|
||||||
return r_find_particular(begin(), end(), end(), key);
|
return r_find_particular(begin(), end(), end(), key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,7 +482,7 @@ find_particular(const ordered_vector<Key, Compare>::key_type &key) const {
|
|||||||
// to the key that are in the vector.
|
// to the key that are in the vector.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::size_type ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::SIZE_TYPE ordered_vector<Key, Compare>::
|
||||||
count(const key_type &key) const {
|
count(const key_type &key) const {
|
||||||
return r_count(begin(), end(), key);
|
return r_count(begin(), end(), key);
|
||||||
}
|
}
|
||||||
@ -494,8 +494,8 @@ count(const key_type &key) const {
|
|||||||
// than key, or end() if all elements are less than key.
|
// than key, or end() if all elements are less than key.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::iterator ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::ITERATOR ordered_vector<Key, Compare>::
|
||||||
lower_bound(const ordered_vector<Key, Compare>::key_type &key) {
|
lower_bound(const ordered_vector<Key, Compare>::KEY_TYPE &key) {
|
||||||
return nci(r_lower_bound(begin(), end(), key));
|
return nci(r_lower_bound(begin(), end(), key));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -506,8 +506,8 @@ lower_bound(const ordered_vector<Key, Compare>::key_type &key) {
|
|||||||
// than key, or end() if all elements are less than key.
|
// than key, or end() if all elements are less than key.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::const_iterator ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::CONST_ITERATOR ordered_vector<Key, Compare>::
|
||||||
lower_bound(const ordered_vector<Key, Compare>::key_type &key) const {
|
lower_bound(const ordered_vector<Key, Compare>::KEY_TYPE &key) const {
|
||||||
return r_lower_bound(begin(), end(), key);
|
return r_lower_bound(begin(), end(), key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,8 +519,8 @@ lower_bound(const ordered_vector<Key, Compare>::key_type &key) const {
|
|||||||
// key.
|
// key.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::iterator ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::ITERATOR ordered_vector<Key, Compare>::
|
||||||
upper_bound(const ordered_vector<Key, Compare>::key_type &key) {
|
upper_bound(const ordered_vector<Key, Compare>::KEY_TYPE &key) {
|
||||||
return nci(r_upper_bound(begin(), end(), key));
|
return nci(r_upper_bound(begin(), end(), key));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -532,8 +532,8 @@ upper_bound(const ordered_vector<Key, Compare>::key_type &key) {
|
|||||||
// key.
|
// key.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::const_iterator ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::CONST_ITERATOR ordered_vector<Key, Compare>::
|
||||||
upper_bound(const ordered_vector<Key, Compare>::key_type &key) const {
|
upper_bound(const ordered_vector<Key, Compare>::KEY_TYPE &key) const {
|
||||||
return r_upper_bound(begin(), end(), key);
|
return r_upper_bound(begin(), end(), key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,11 +543,11 @@ upper_bound(const ordered_vector<Key, Compare>::key_type &key) const {
|
|||||||
// Description: Returns the pair (lower_bound(key), upper_bound(key)).
|
// Description: Returns the pair (lower_bound(key), upper_bound(key)).
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE pair<ordered_vector<Key, Compare>::iterator, ordered_vector<Key, Compare>::iterator> ordered_vector<Key, Compare>::
|
INLINE pair<ordered_vector<Key, Compare>::ITERATOR, ordered_vector<Key, Compare>::ITERATOR> ordered_vector<Key, Compare>::
|
||||||
equal_range(const ordered_vector<Key, Compare>::key_type &key) {
|
equal_range(const ordered_vector<Key, Compare>::KEY_TYPE &key) {
|
||||||
pair<ordered_vector<Key, Compare>::const_iterator, ordered_vector<Key, Compare>::const_iterator> result;
|
pair<ordered_vector<Key, Compare>::CONST_ITERATOR, ordered_vector<Key, Compare>::CONST_ITERATOR> result;
|
||||||
result = r_equal_range(begin(), end(), key);
|
result = r_equal_range(begin(), end(), key);
|
||||||
return pair<ordered_vector<Key, Compare>::iterator, ordered_vector<Key, Compare>::iterator>(nci(result.first), nci(result.second));
|
return pair<ordered_vector<Key, Compare>::ITERATOR, ordered_vector<Key, Compare>::ITERATOR>(nci(result.first), nci(result.second));
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -556,8 +556,8 @@ equal_range(const ordered_vector<Key, Compare>::key_type &key) {
|
|||||||
// Description: Returns the pair (lower_bound(key), upper_bound(key)).
|
// Description: Returns the pair (lower_bound(key), upper_bound(key)).
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE pair<ordered_vector<Key, Compare>::const_iterator, ordered_vector<Key, Compare>::const_iterator> ordered_vector<Key, Compare>::
|
INLINE pair<ordered_vector<Key, Compare>::CONST_ITERATOR, ordered_vector<Key, Compare>::CONST_ITERATOR> ordered_vector<Key, Compare>::
|
||||||
equal_range(const ordered_vector<Key, Compare>::key_type &key) const {
|
equal_range(const ordered_vector<Key, Compare>::KEY_TYPE &key) const {
|
||||||
return r_equal_range(begin(), end(), key);
|
return r_equal_range(begin(), end(), key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,7 +582,7 @@ swap(ordered_vector<Key, Compare> ©) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE void ordered_vector<Key, Compare>::
|
INLINE void ordered_vector<Key, Compare>::
|
||||||
reserve(ordered_vector<Key, Compare>::size_type n) {
|
reserve(ordered_vector<Key, Compare>::SIZE_TYPE n) {
|
||||||
_vector.reserve(n);
|
_vector.reserve(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -644,9 +644,9 @@ push_back(const value_type &key) {
|
|||||||
// some of these methods.
|
// some of these methods.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::iterator ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::ITERATOR ordered_vector<Key, Compare>::
|
||||||
nci(ordered_vector<Key, Compare>::const_iterator iterator) {
|
nci(ordered_vector<Key, Compare>::CONST_ITERATOR i) {
|
||||||
return begin() + (iterator - begin());
|
return begin() + (i - begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -657,11 +657,11 @@ nci(ordered_vector<Key, Compare>::const_iterator iterator) {
|
|||||||
// corresponding iterator.
|
// corresponding iterator.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ordered_vector<Key, Compare>::iterator ordered_vector<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::ITERATOR ordered_vector<Key, Compare>::
|
||||||
find_insert_position(ordered_vector<Key, Compare>::iterator first,
|
find_insert_position(ordered_vector<Key, Compare>::ITERATOR first,
|
||||||
ordered_vector<Key, Compare>::iterator last,
|
ordered_vector<Key, Compare>::ITERATOR last,
|
||||||
const ordered_vector<Key, Compare>::key_type &key) {
|
const ordered_vector<Key, Compare>::KEY_TYPE &key) {
|
||||||
iterator result = r_find_insert_position(first, last, key);
|
ITERATOR result = r_find_insert_position(first, last, key);
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
// Verify the result.
|
// Verify the result.
|
||||||
@ -743,9 +743,9 @@ operator = (const ov_set<Key, Compare> ©) {
|
|||||||
// Description: Maps to insert_unique().
|
// Description: Maps to insert_unique().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
ov_set<Key, Compare>::iterator ov_set<Key, Compare>::
|
ordered_vector<Key, Compare>::ITERATOR ov_set<Key, Compare>::
|
||||||
insert(ordered_vector<Key, Compare>::iterator position,
|
insert(ordered_vector<Key, Compare>::ITERATOR position,
|
||||||
const ordered_vector<Key, Compare>::value_type &key) {
|
const ordered_vector<Key, Compare>::VALUE_TYPE &key) {
|
||||||
return ordered_vector<Key, Compare>::insert_unique(position, key);
|
return ordered_vector<Key, Compare>::insert_unique(position, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -755,8 +755,8 @@ insert(ordered_vector<Key, Compare>::iterator position,
|
|||||||
// Description: Maps to insert_unique().
|
// Description: Maps to insert_unique().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE pair<ov_set<Key, Compare>::iterator, bool> ov_set<Key, Compare>::
|
INLINE pair<ordered_vector<Key, Compare>::ITERATOR, bool> ov_set<Key, Compare>::
|
||||||
insert(const ordered_vector<Key, Compare>::value_type &key) {
|
insert(const ordered_vector<Key, Compare>::VALUE_TYPE &key) {
|
||||||
return ordered_vector<Key, Compare>::insert_unique(key);
|
return ordered_vector<Key, Compare>::insert_unique(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -813,9 +813,9 @@ operator = (const ov_multiset<Key, Compare> ©) {
|
|||||||
// Description: Maps to insert_nonunique().
|
// Description: Maps to insert_nonunique().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
ov_multiset<Key, Compare>::iterator ov_multiset<Key, Compare>::
|
ordered_vector<Key, Compare>::ITERATOR ov_multiset<Key, Compare>::
|
||||||
insert(ov_multiset<Key, Compare>::iterator position,
|
insert(ordered_vector<Key, Compare>::ITERATOR position,
|
||||||
const ov_multiset<Key, Compare>::value_type &key) {
|
const ordered_vector<Key, Compare>::VALUE_TYPE &key) {
|
||||||
return ordered_vector<Key, Compare>::insert_nonunique(position, key);
|
return ordered_vector<Key, Compare>::insert_nonunique(position, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -825,8 +825,8 @@ insert(ov_multiset<Key, Compare>::iterator position,
|
|||||||
// Description: Maps to insert_nonunique().
|
// Description: Maps to insert_nonunique().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE ov_multiset<Key, Compare>::iterator ov_multiset<Key, Compare>::
|
INLINE ordered_vector<Key, Compare>::ITERATOR ov_multiset<Key, Compare>::
|
||||||
insert(const ov_multiset<Key, Compare>::value_type &key) {
|
insert(const ordered_vector<Key, Compare>::VALUE_TYPE &key) {
|
||||||
return ordered_vector<Key, Compare>::insert_nonunique(key);
|
return ordered_vector<Key, Compare>::insert_nonunique(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,9 +32,9 @@
|
|||||||
// referencing the original value is returned.
|
// referencing the original value is returned.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
ordered_vector<Key, Compare>::iterator ordered_vector<Key, Compare>::
|
ordered_vector<Key, Compare>::ITERATOR ordered_vector<Key, Compare>::
|
||||||
insert_unique(ordered_vector<Key, Compare>::iterator position,
|
insert_unique(ordered_vector<Key, Compare>::ITERATOR position,
|
||||||
const ordered_vector<Key, Compare>::value_type &key) {
|
const ordered_vector<Key, Compare>::VALUE_TYPE &key) {
|
||||||
if (position != end()) {
|
if (position != end()) {
|
||||||
// If we're not inserting at the end, the element we're
|
// If we're not inserting at the end, the element we're
|
||||||
// inserting before should not lexicographically precede this one.
|
// inserting before should not lexicographically precede this one.
|
||||||
@ -61,7 +61,7 @@ insert_unique(ordered_vector<Key, Compare>::iterator position,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, we may insert where the caller requested.
|
// Otherwise, we may insert where the caller requested.
|
||||||
iterator result = _vector.insert(position, key);
|
ITERATOR result = _vector.insert(position, key);
|
||||||
verify_list();
|
verify_list();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -79,9 +79,9 @@ insert_unique(ordered_vector<Key, Compare>::iterator position,
|
|||||||
// same key to be inserted.
|
// same key to be inserted.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
ordered_vector<Key, Compare>::iterator ordered_vector<Key, Compare>::
|
ordered_vector<Key, Compare>::ITERATOR ordered_vector<Key, Compare>::
|
||||||
insert_nonunique(ordered_vector<Key, Compare>::iterator position,
|
insert_nonunique(ordered_vector<Key, Compare>::ITERATOR position,
|
||||||
const ordered_vector<Key, Compare>::value_type &key) {
|
const ordered_vector<Key, Compare>::VALUE_TYPE &key) {
|
||||||
if (position != end()) {
|
if (position != end()) {
|
||||||
// If we're not inserting at the end, the element we're
|
// If we're not inserting at the end, the element we're
|
||||||
// inserting before should not lexicographically precede this one.
|
// inserting before should not lexicographically precede this one.
|
||||||
@ -99,7 +99,7 @@ insert_nonunique(ordered_vector<Key, Compare>::iterator position,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, we may insert where the caller requested.
|
// Otherwise, we may insert where the caller requested.
|
||||||
iterator result = _vector.insert(position, key);
|
ITERATOR result = _vector.insert(position, key);
|
||||||
verify_list();
|
verify_list();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -111,16 +111,16 @@ insert_nonunique(ordered_vector<Key, Compare>::iterator position,
|
|||||||
// find_insert_position().
|
// find_insert_position().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
ordered_vector<Key, Compare>::iterator ordered_vector<Key, Compare>::
|
ordered_vector<Key, Compare>::ITERATOR ordered_vector<Key, Compare>::
|
||||||
r_find_insert_position(ordered_vector<Key, Compare>::iterator first,
|
r_find_insert_position(ordered_vector<Key, Compare>::ITERATOR first,
|
||||||
ordered_vector<Key, Compare>::iterator last,
|
ordered_vector<Key, Compare>::ITERATOR last,
|
||||||
const ordered_vector<Key, Compare>::key_type &key) {
|
const ordered_vector<Key, Compare>::KEY_TYPE &key) {
|
||||||
if (first == last) {
|
if (first == last) {
|
||||||
// The list is empty; the insert position is the last of the list.
|
// The list is empty; the insert position is the last of the list.
|
||||||
return last;
|
return last;
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator center = first + (last - first) / 2;
|
ITERATOR center = first + (last - first) / 2;
|
||||||
nassertr(center < last, last);
|
nassertr(center < last, last);
|
||||||
|
|
||||||
if (_compare(key, *center)) {
|
if (_compare(key, *center)) {
|
||||||
@ -139,17 +139,17 @@ r_find_insert_position(ordered_vector<Key, Compare>::iterator first,
|
|||||||
// Description: The recursive implementation of find().
|
// Description: The recursive implementation of find().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
ordered_vector<Key, Compare>::const_iterator ordered_vector<Key, Compare>::
|
ordered_vector<Key, Compare>::CONST_ITERATOR ordered_vector<Key, Compare>::
|
||||||
r_find(ordered_vector<Key, Compare>::const_iterator first,
|
r_find(ordered_vector<Key, Compare>::CONST_ITERATOR first,
|
||||||
ordered_vector<Key, Compare>::const_iterator last,
|
ordered_vector<Key, Compare>::CONST_ITERATOR last,
|
||||||
ordered_vector<Key, Compare>::const_iterator not_found,
|
ordered_vector<Key, Compare>::CONST_ITERATOR not_found,
|
||||||
const ordered_vector<Key, Compare>::key_type &key) const {
|
const ordered_vector<Key, Compare>::KEY_TYPE &key) const {
|
||||||
if (first == last) {
|
if (first == last) {
|
||||||
// The list is empty; the key is not on the list.
|
// The list is empty; the key is not on the list.
|
||||||
return not_found;
|
return not_found;
|
||||||
}
|
}
|
||||||
|
|
||||||
const_iterator center = first + (last - first) / 2;
|
CONST_ITERATOR center = first + (last - first) / 2;
|
||||||
nassertr(center < last, last);
|
nassertr(center < last, last);
|
||||||
|
|
||||||
if (_compare(key, *center)) {
|
if (_compare(key, *center)) {
|
||||||
@ -172,17 +172,17 @@ r_find(ordered_vector<Key, Compare>::const_iterator first,
|
|||||||
// Description: The recursive implementation of find_particular().
|
// Description: The recursive implementation of find_particular().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
ordered_vector<Key, Compare>::const_iterator ordered_vector<Key, Compare>::
|
ordered_vector<Key, Compare>::CONST_ITERATOR ordered_vector<Key, Compare>::
|
||||||
r_find_particular(ordered_vector<Key, Compare>::const_iterator first,
|
r_find_particular(ordered_vector<Key, Compare>::CONST_ITERATOR first,
|
||||||
ordered_vector<Key, Compare>::const_iterator last,
|
ordered_vector<Key, Compare>::CONST_ITERATOR last,
|
||||||
ordered_vector<Key, Compare>::const_iterator not_found,
|
ordered_vector<Key, Compare>::CONST_ITERATOR not_found,
|
||||||
const ordered_vector<Key, Compare>::key_type &key) const {
|
const ordered_vector<Key, Compare>::KEY_TYPE &key) const {
|
||||||
if (first == last) {
|
if (first == last) {
|
||||||
// The list is empty; the key is not on the list.
|
// The list is empty; the key is not on the list.
|
||||||
return not_found;
|
return not_found;
|
||||||
}
|
}
|
||||||
|
|
||||||
const_iterator center = first + (last - first) / 2;
|
CONST_ITERATOR center = first + (last - first) / 2;
|
||||||
nassertr(center < last, last);
|
nassertr(center < last, last);
|
||||||
|
|
||||||
if (_compare(key, *center)) {
|
if (_compare(key, *center)) {
|
||||||
@ -196,7 +196,7 @@ r_find_particular(ordered_vector<Key, Compare>::const_iterator first,
|
|||||||
} else {
|
} else {
|
||||||
// The center's sort matches the key's sort. It could be either
|
// The center's sort matches the key's sort. It could be either
|
||||||
// before or after the center. First try after.
|
// before or after the center. First try after.
|
||||||
const_iterator i = center;
|
CONST_ITERATOR i = center;
|
||||||
while (i < last && !_compare(key, *i)) {
|
while (i < last && !_compare(key, *i)) {
|
||||||
if ((*i) == key) {
|
if ((*i) == key) {
|
||||||
return i;
|
return i;
|
||||||
@ -225,18 +225,18 @@ r_find_particular(ordered_vector<Key, Compare>::const_iterator first,
|
|||||||
// Description: The recursive implementation of count().
|
// Description: The recursive implementation of count().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
ordered_vector<Key, Compare>::size_type ordered_vector<Key, Compare>::
|
ordered_vector<Key, Compare>::SIZE_TYPE ordered_vector<Key, Compare>::
|
||||||
r_count(ordered_vector<Key, Compare>::const_iterator first,
|
r_count(ordered_vector<Key, Compare>::CONST_ITERATOR first,
|
||||||
ordered_vector<Key, Compare>::const_iterator last,
|
ordered_vector<Key, Compare>::CONST_ITERATOR last,
|
||||||
const ordered_vector<Key, Compare>::key_type &key) const {
|
const ordered_vector<Key, Compare>::KEY_TYPE &key) const {
|
||||||
typedef pair<ordered_vector<Key, Compare>::const_iterator, ordered_vector<Key, Compare>::const_iterator> pair_type;
|
typedef pair<ordered_vector<Key, Compare>::CONST_ITERATOR, ordered_vector<Key, Compare>::CONST_ITERATOR> pair_type;
|
||||||
|
|
||||||
if (first == last) {
|
if (first == last) {
|
||||||
// The list is empty; the key is not on the list.
|
// The list is empty; the key is not on the list.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const_iterator center = first + (last - first) / 2;
|
CONST_ITERATOR center = first + (last - first) / 2;
|
||||||
nassertr(center < last, 0);
|
nassertr(center < last, 0);
|
||||||
|
|
||||||
if (_compare(key, *center)) {
|
if (_compare(key, *center)) {
|
||||||
@ -261,16 +261,16 @@ r_count(ordered_vector<Key, Compare>::const_iterator first,
|
|||||||
// Description: The recursive implementation of lower_bound().
|
// Description: The recursive implementation of lower_bound().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
ordered_vector<Key, Compare>::const_iterator ordered_vector<Key, Compare>::
|
ordered_vector<Key, Compare>::CONST_ITERATOR ordered_vector<Key, Compare>::
|
||||||
r_lower_bound(ordered_vector<Key, Compare>::const_iterator first,
|
r_lower_bound(ordered_vector<Key, Compare>::CONST_ITERATOR first,
|
||||||
ordered_vector<Key, Compare>::const_iterator last,
|
ordered_vector<Key, Compare>::CONST_ITERATOR last,
|
||||||
const ordered_vector<Key, Compare>::key_type &key) const {
|
const ordered_vector<Key, Compare>::KEY_TYPE &key) const {
|
||||||
if (first == last) {
|
if (first == last) {
|
||||||
// The list is empty; the key is not on the list.
|
// The list is empty; the key is not on the list.
|
||||||
return last;
|
return last;
|
||||||
}
|
}
|
||||||
|
|
||||||
const_iterator center = first + (last - first) / 2;
|
CONST_ITERATOR center = first + (last - first) / 2;
|
||||||
nassertr(center < last, last);
|
nassertr(center < last, last);
|
||||||
|
|
||||||
if (_compare(key, *center)) {
|
if (_compare(key, *center)) {
|
||||||
@ -294,10 +294,10 @@ r_lower_bound(ordered_vector<Key, Compare>::const_iterator first,
|
|||||||
// Description: The recursive implementation of upper_bound().
|
// Description: The recursive implementation of upper_bound().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
ordered_vector<Key, Compare>::const_iterator ordered_vector<Key, Compare>::
|
ordered_vector<Key, Compare>::CONST_ITERATOR ordered_vector<Key, Compare>::
|
||||||
r_upper_bound(ordered_vector<Key, Compare>::const_iterator first,
|
r_upper_bound(ordered_vector<Key, Compare>::CONST_ITERATOR first,
|
||||||
ordered_vector<Key, Compare>::const_iterator last,
|
ordered_vector<Key, Compare>::CONST_ITERATOR last,
|
||||||
const ordered_vector<Key, Compare>::key_type &key) const {
|
const ordered_vector<Key, Compare>::KEY_TYPE &key) const {
|
||||||
if (first == last) {
|
if (first == last) {
|
||||||
// The list is empty; the key is not on the list.
|
// The list is empty; the key is not on the list.
|
||||||
return last;
|
return last;
|
||||||
@ -327,18 +327,18 @@ r_upper_bound(ordered_vector<Key, Compare>::const_iterator first,
|
|||||||
// Description: The recursive implementation of equal_range().
|
// Description: The recursive implementation of equal_range().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
pair<ordered_vector<Key, Compare>::const_iterator, ordered_vector<Key, Compare>::const_iterator> ordered_vector<Key, Compare>::
|
pair<ordered_vector<Key, Compare>::CONST_ITERATOR, ordered_vector<Key, Compare>::CONST_ITERATOR> ordered_vector<Key, Compare>::
|
||||||
r_equal_range(ordered_vector<Key, Compare>::const_iterator first,
|
r_equal_range(ordered_vector<Key, Compare>::CONST_ITERATOR first,
|
||||||
ordered_vector<Key, Compare>::const_iterator last,
|
ordered_vector<Key, Compare>::CONST_ITERATOR last,
|
||||||
const ordered_vector<Key, Compare>::key_type &key) const {
|
const ordered_vector<Key, Compare>::KEY_TYPE &key) const {
|
||||||
typedef pair<ordered_vector<Key, Compare>::const_iterator, ordered_vector<Key, Compare>::const_iterator> pair_type;
|
typedef pair<ordered_vector<Key, Compare>::CONST_ITERATOR, ordered_vector<Key, Compare>::CONST_ITERATOR> pair_type;
|
||||||
|
|
||||||
if (first == last) {
|
if (first == last) {
|
||||||
// The list is empty; the key is not on the list.
|
// The list is empty; the key is not on the list.
|
||||||
return pair_type(last, last);
|
return pair_type(last, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
const_iterator center = first + (last - first) / 2;
|
CONST_ITERATOR center = first + (last - first) / 2;
|
||||||
nassertr(center < last, pair_type(last, last));
|
nassertr(center < last, pair_type(last, last));
|
||||||
|
|
||||||
if (_compare(key, *center)) {
|
if (_compare(key, *center)) {
|
||||||
@ -351,8 +351,8 @@ r_equal_range(ordered_vector<Key, Compare>::const_iterator first,
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
// The center matches the key; the range is here.
|
// The center matches the key; the range is here.
|
||||||
const_iterator lower = r_lower_bound(first, center, key);
|
CONST_ITERATOR lower = r_lower_bound(first, center, key);
|
||||||
const_iterator upper = r_upper_bound(center + 1, last, key);
|
CONST_ITERATOR upper = r_upper_bound(center + 1, last, key);
|
||||||
return pair_type(lower, upper);
|
return pair_type(lower, upper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -365,11 +365,11 @@ r_equal_range(ordered_vector<Key, Compare>::const_iterator first,
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
bool ordered_vector<Key, Compare>::
|
bool ordered_vector<Key, Compare>::
|
||||||
verify_list_impl(ordered_vector<Key, Compare>::iterator first,
|
verify_list_impl(ordered_vector<Key, Compare>::ITERATOR first,
|
||||||
ordered_vector<Key, Compare>::iterator last) {
|
ordered_vector<Key, Compare>::ITERATOR last) {
|
||||||
if (first < last) {
|
if (first < last) {
|
||||||
iterator prev = first;
|
ITERATOR prev = first;
|
||||||
iterator i = first;
|
ITERATOR i = first;
|
||||||
++i;
|
++i;
|
||||||
while (i < last) {
|
while (i < last) {
|
||||||
bool ordered_correctly = !_compare(*i, *prev);
|
bool ordered_correctly = !_compare(*i, *prev);
|
||||||
|
@ -26,6 +26,54 @@
|
|||||||
#include "pset.h"
|
#include "pset.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
// Two different compilers that both should have known better had
|
||||||
|
// problems parsing the inheritance of typedefs in the template
|
||||||
|
// classes below. Both gcc 2.95.3 and the Intel Windows compiler (not
|
||||||
|
// sure of the version) got confused in different ways. It is a
|
||||||
|
// mystery how these compilers are able to handle the actual STL
|
||||||
|
// headers, which do this sort of thing all over the place.
|
||||||
|
|
||||||
|
// One effective workaround for both compilers seems to be to rename
|
||||||
|
// the typedef names slightly. If the following symbol is declared,
|
||||||
|
// the macros in this file will do the job of renaming the typedef
|
||||||
|
// names for these broken compilers. We should probably make this a
|
||||||
|
// configurable parameter, but since it doesn't do any harm to leave
|
||||||
|
// it declared even for non-broken compilers, we might as well just
|
||||||
|
// leave it alone.
|
||||||
|
#define BROKEN_TYPEDEF_INHERITANCE 1
|
||||||
|
|
||||||
|
// Maybe eventually, when STL is more than only about ten years old
|
||||||
|
// and compiler support of anything more than trivial template classes
|
||||||
|
// is more universal, we can pull this nonsense out of here.
|
||||||
|
|
||||||
|
#ifdef BROKEN_TYPEDEF_INHERITANCE
|
||||||
|
#define KEY_TYPE key_type_0
|
||||||
|
#define VALUE_TYPE value_type_0
|
||||||
|
#define REFERENCE reference_0
|
||||||
|
#define CONST_REFERENCE const_reference_0
|
||||||
|
#define KEY_COMPARE key_compare_0
|
||||||
|
#define VALUE_COMPARE value_compare_0
|
||||||
|
#define ITERATOR iterator_0
|
||||||
|
#define CONST_ITERATOR const_iterator_0
|
||||||
|
#define REVERSE_ITERATOR reverse_iterator_0
|
||||||
|
#define CONST_REVERSE_ITERATOR const_reverse_iterator_0
|
||||||
|
#define DIFFERENCE_TYPE difference_type_0
|
||||||
|
#define SIZE_TYPE size_type_0
|
||||||
|
#else
|
||||||
|
#define KEY_TYPE key_type
|
||||||
|
#define VALUE_TYPE value_type
|
||||||
|
#define REFERENCE reference
|
||||||
|
#define CONST_REFERENCE const_reference
|
||||||
|
#define KEY_COMPARE key_compare
|
||||||
|
#define VALUE_COMPARE value_compare
|
||||||
|
#define ITERATOR iterator
|
||||||
|
#define CONST_ITERATOR const_iterator
|
||||||
|
#define REVERSE_ITERATOR reverse_iterator
|
||||||
|
#define CONST_REVERSE_ITERATOR const_reverse_iterator
|
||||||
|
#define DIFFERENCE_TYPE difference_type
|
||||||
|
#define SIZE_TYPE size_type
|
||||||
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Class : ordered_vector
|
// Class : ordered_vector
|
||||||
// Description : This template class presents an interface similar to
|
// Description : This template class presents an interface similar to
|
||||||
@ -69,23 +117,41 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Typedefs
|
// Typedefs
|
||||||
typedef Key key_type;
|
typedef Key KEY_TYPE;
|
||||||
typedef Key value_type;
|
typedef Key VALUE_TYPE;
|
||||||
typedef Key &reference;
|
typedef Key &REFERENCE;
|
||||||
typedef const Key &const_reference;
|
typedef const Key &CONST_REFERENCE;
|
||||||
typedef Compare key_compare;
|
typedef Compare KEY_COMPARE;
|
||||||
typedef Compare value_compare;
|
typedef Compare VALUE_COMPARE;
|
||||||
|
|
||||||
// Be careful when using the non-const iterators that you do not
|
// Be careful when using the non-const iterators that you do not
|
||||||
// disturb the sorted order of the vector, or that if you do, you
|
// disturb the sorted order of the vector, or that if you do, you
|
||||||
// call sort() when you are done.
|
// call sort() when you are done.
|
||||||
typedef Vector::iterator iterator;
|
typedef Vector::iterator ITERATOR;
|
||||||
typedef Vector::const_iterator const_iterator;
|
typedef Vector::const_iterator CONST_ITERATOR;
|
||||||
typedef Vector::reverse_iterator reverse_iterator;
|
typedef Vector::reverse_iterator REVERSE_ITERATOR;
|
||||||
typedef Vector::const_reverse_iterator const_reverse_iterator;
|
typedef Vector::const_reverse_iterator CONST_REVERSE_ITERATOR;
|
||||||
|
|
||||||
typedef Vector::difference_type difference_type;
|
typedef Vector::difference_type DIFFERENCE_TYPE;
|
||||||
typedef Vector::size_type size_type;
|
typedef Vector::size_type SIZE_TYPE;
|
||||||
|
|
||||||
|
#ifdef BROKEN_TYPEDEF_INHERITANCE
|
||||||
|
// Since the #define symbols do not actually expand to the correct
|
||||||
|
// names, we have to re-typedef them so callers can reference them
|
||||||
|
// by their correct, lowercase names.
|
||||||
|
typedef KEY_TYPE key_type;
|
||||||
|
typedef VALUE_TYPE value_type;
|
||||||
|
typedef REFERENCE reference;
|
||||||
|
typedef CONST_REFERENCE const_reference;
|
||||||
|
typedef KEY_COMPARE key_compare;
|
||||||
|
typedef VALUE_COMPARE value_compare;
|
||||||
|
typedef ITERATOR iterator;
|
||||||
|
typedef CONST_ITERATOR const_iterator;
|
||||||
|
typedef REVERSE_ITERATOR reverse_iterator;
|
||||||
|
typedef CONST_REVERSE_ITERATOR const_reverse_iterator;
|
||||||
|
typedef DIFFERENCE_TYPE difference_type;
|
||||||
|
typedef SIZE_TYPE size_type;
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructors. We don't implement the whole slew of STL
|
// Constructors. We don't implement the whole slew of STL
|
||||||
@ -96,23 +162,23 @@ public:
|
|||||||
INLINE ~ordered_vector();
|
INLINE ~ordered_vector();
|
||||||
|
|
||||||
// Iterator access.
|
// Iterator access.
|
||||||
INLINE iterator begin();
|
INLINE ITERATOR begin();
|
||||||
INLINE iterator end();
|
INLINE ITERATOR end();
|
||||||
INLINE reverse_iterator rbegin();
|
INLINE REVERSE_ITERATOR rbegin();
|
||||||
INLINE reverse_iterator rend();
|
INLINE REVERSE_ITERATOR rend();
|
||||||
|
|
||||||
INLINE const_iterator begin() const;
|
INLINE CONST_ITERATOR begin() const;
|
||||||
INLINE const_iterator end() const;
|
INLINE CONST_ITERATOR end() const;
|
||||||
INLINE const_reverse_iterator rbegin() const;
|
INLINE CONST_REVERSE_ITERATOR rbegin() const;
|
||||||
INLINE const_reverse_iterator rend() const;
|
INLINE CONST_REVERSE_ITERATOR rend() const;
|
||||||
|
|
||||||
// Random access.
|
// Random access.
|
||||||
INLINE reference operator [] (size_type n);
|
INLINE reference operator [] (SIZE_TYPE n);
|
||||||
INLINE const_reference operator [] (size_type n) const;
|
INLINE const_reference operator [] (SIZE_TYPE n) const;
|
||||||
|
|
||||||
// Size information.
|
// Size information.
|
||||||
INLINE size_type size() const;
|
INLINE SIZE_TYPE size() const;
|
||||||
INLINE size_type max_size() const;
|
INLINE SIZE_TYPE max_size() const;
|
||||||
INLINE bool empty() const;
|
INLINE bool empty() const;
|
||||||
|
|
||||||
// Equivalence and lexicographical comparisons.
|
// Equivalence and lexicographical comparisons.
|
||||||
@ -125,64 +191,64 @@ public:
|
|||||||
INLINE bool operator >= (const ordered_vector<Key, Compare> &other) const;
|
INLINE bool operator >= (const ordered_vector<Key, Compare> &other) const;
|
||||||
|
|
||||||
// Insert operations.
|
// Insert operations.
|
||||||
iterator insert_unique(iterator position, const value_type &key);
|
ITERATOR insert_unique(ITERATOR position, const VALUE_TYPE &key);
|
||||||
iterator insert_nonunique(iterator position, const value_type &key);
|
ITERATOR insert_nonunique(ITERATOR position, const VALUE_TYPE &key);
|
||||||
INLINE pair<iterator, bool> insert_unique(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_nonunique(const VALUE_TYPE &key);
|
||||||
|
|
||||||
// Erase operations.
|
// Erase operations.
|
||||||
INLINE iterator erase(iterator position);
|
INLINE ITERATOR erase(ITERATOR position);
|
||||||
INLINE size_type erase(const key_type &key);
|
INLINE SIZE_TYPE erase(const KEY_TYPE &key);
|
||||||
INLINE void erase(iterator first, iterator last);
|
INLINE void erase(ITERATOR first, ITERATOR last);
|
||||||
INLINE void clear();
|
INLINE void clear();
|
||||||
|
|
||||||
// Find operations.
|
// Find operations.
|
||||||
INLINE iterator find(const key_type &key);
|
INLINE ITERATOR find(const KEY_TYPE &key);
|
||||||
INLINE const_iterator find(const key_type &key) const;
|
INLINE CONST_ITERATOR find(const KEY_TYPE &key) const;
|
||||||
INLINE iterator find_particular(const key_type &key);
|
INLINE ITERATOR find_particular(const KEY_TYPE &key);
|
||||||
INLINE const_iterator find_particular(const key_type &key) const;
|
INLINE CONST_ITERATOR find_particular(const KEY_TYPE &key) const;
|
||||||
INLINE size_type count(const key_type &key) const;
|
INLINE SIZE_TYPE count(const KEY_TYPE &key) const;
|
||||||
|
|
||||||
INLINE iterator lower_bound(const key_type &key);
|
INLINE ITERATOR lower_bound(const KEY_TYPE &key);
|
||||||
INLINE const_iterator lower_bound(const key_type &key) const;
|
INLINE CONST_ITERATOR lower_bound(const KEY_TYPE &key) const;
|
||||||
INLINE iterator upper_bound(const key_type &key);
|
INLINE ITERATOR upper_bound(const KEY_TYPE &key);
|
||||||
INLINE const_iterator upper_bound(const key_type &key) const;
|
INLINE CONST_ITERATOR upper_bound(const KEY_TYPE &key) const;
|
||||||
INLINE pair<iterator, iterator> equal_range(const key_type &key);
|
INLINE pair<ITERATOR, ITERATOR> equal_range(const KEY_TYPE &key);
|
||||||
INLINE pair<const_iterator, const_iterator> equal_range(const key_type &key) const;
|
INLINE pair<CONST_ITERATOR, CONST_ITERATOR> equal_range(const KEY_TYPE &key) const;
|
||||||
|
|
||||||
// Special operations.
|
// Special operations.
|
||||||
INLINE void swap(ordered_vector<Key, Compare> &other);
|
INLINE void swap(ordered_vector<Key, Compare> &other);
|
||||||
INLINE void reserve(size_type n);
|
INLINE void reserve(SIZE_TYPE n);
|
||||||
INLINE void sort_unique();
|
INLINE void sort_unique();
|
||||||
INLINE void sort_nonunique();
|
INLINE void sort_nonunique();
|
||||||
|
|
||||||
INLINE void push_back(const value_type &key);
|
INLINE void push_back(const VALUE_TYPE &key);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
INLINE iterator nci(const_iterator iterator);
|
INLINE ITERATOR nci(CONST_ITERATOR i);
|
||||||
INLINE iterator find_insert_position(iterator first, iterator last,
|
INLINE ITERATOR find_insert_position(ITERATOR first, ITERATOR last,
|
||||||
const key_type &key);
|
const KEY_TYPE &key);
|
||||||
iterator r_find_insert_position(iterator first, iterator last,
|
ITERATOR r_find_insert_position(ITERATOR first, ITERATOR last,
|
||||||
const key_type &key);
|
const KEY_TYPE &key);
|
||||||
const_iterator r_find(const_iterator first, const_iterator last,
|
CONST_ITERATOR r_find(CONST_ITERATOR first, CONST_ITERATOR last,
|
||||||
const_iterator not_found,
|
CONST_ITERATOR not_found,
|
||||||
const key_type &key) const;
|
const KEY_TYPE &key) const;
|
||||||
const_iterator r_find_particular(const_iterator first, const_iterator last,
|
CONST_ITERATOR r_find_particular(CONST_ITERATOR first, CONST_ITERATOR last,
|
||||||
const_iterator not_found,
|
CONST_ITERATOR not_found,
|
||||||
const key_type &key) const;
|
const KEY_TYPE &key) const;
|
||||||
size_type r_count(const_iterator first, const_iterator last,
|
SIZE_TYPE r_count(CONST_ITERATOR first, CONST_ITERATOR last,
|
||||||
const key_type &key) const;
|
const KEY_TYPE &key) const;
|
||||||
const_iterator r_lower_bound(const_iterator first, const_iterator last,
|
CONST_ITERATOR r_lower_bound(CONST_ITERATOR first, CONST_ITERATOR last,
|
||||||
const key_type &key) const;
|
const KEY_TYPE &key) const;
|
||||||
const_iterator r_upper_bound(const_iterator first, const_iterator last,
|
CONST_ITERATOR r_upper_bound(CONST_ITERATOR first, CONST_ITERATOR last,
|
||||||
const key_type &key) const;
|
const KEY_TYPE &key) const;
|
||||||
pair<const_iterator, const_iterator>
|
pair<CONST_ITERATOR, CONST_ITERATOR>
|
||||||
r_equal_range(const_iterator first, const_iterator last,
|
r_equal_range(CONST_ITERATOR first, CONST_ITERATOR last,
|
||||||
const key_type &key) const;
|
const KEY_TYPE &key) const;
|
||||||
INLINE bool verify_list();
|
INLINE bool verify_list();
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
bool verify_list_impl(iterator first, iterator last);
|
bool verify_list_impl(ITERATOR first, ITERATOR last);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// This function object is used in sort_unique(). It returns true
|
// This function object is used in sort_unique(). It returns true
|
||||||
@ -195,7 +261,7 @@ private:
|
|||||||
// template class cannot be defined outside the class".
|
// template class cannot be defined outside the class".
|
||||||
INLINE EquivalentTest(const Compare &compare) :
|
INLINE EquivalentTest(const Compare &compare) :
|
||||||
_compare(compare) { }
|
_compare(compare) { }
|
||||||
INLINE bool operator () (const key_type &a, const key_type &b) {
|
INLINE bool operator () (const KEY_TYPE &a, const KEY_TYPE &b) {
|
||||||
nassertr(!_compare(b, a), false);
|
nassertr(!_compare(b, a), false);
|
||||||
return !_compare(a, b);
|
return !_compare(a, b);
|
||||||
}
|
}
|
||||||
@ -216,28 +282,12 @@ private:
|
|||||||
template<class Key, class Compare = less<Key> >
|
template<class Key, class Compare = less<Key> >
|
||||||
class ov_set : public ordered_vector<Key, Compare> {
|
class ov_set : public ordered_vector<Key, Compare> {
|
||||||
public:
|
public:
|
||||||
// The Intel compiler doesn't seem to inherit these typedefs
|
|
||||||
// completely--it gets confused in certain cases. We'll make it
|
|
||||||
// explicit.
|
|
||||||
typedef ordered_vector<Key, Compare>::key_type key_type;
|
|
||||||
typedef ordered_vector<Key, Compare>::value_type value_type;
|
|
||||||
typedef ordered_vector<Key, Compare>::reference reference;
|
|
||||||
typedef ordered_vector<Key, Compare>::const_reference const_reference;
|
|
||||||
typedef ordered_vector<Key, Compare>::key_compare key_compare;
|
|
||||||
typedef ordered_vector<Key, Compare>::value_compare value_compare;
|
|
||||||
typedef ordered_vector<Key, Compare>::iterator iterator;
|
|
||||||
typedef ordered_vector<Key, Compare>::const_iterator const_iterator;
|
|
||||||
typedef ordered_vector<Key, Compare>::reverse_iterator reverse_iterator;
|
|
||||||
typedef ordered_vector<Key, Compare>::const_reverse_iterator const_reverse_iterator;
|
|
||||||
typedef ordered_vector<Key, Compare>::difference_type difference_type;
|
|
||||||
typedef ordered_vector<Key, Compare>::size_type size_type;
|
|
||||||
|
|
||||||
INLINE ov_set(const Compare &compare = Compare());
|
INLINE ov_set(const Compare &compare = Compare());
|
||||||
INLINE ov_set(const ov_set<Key, Compare> ©);
|
INLINE ov_set(const ov_set<Key, Compare> ©);
|
||||||
INLINE ov_set<Key, Compare> &operator = (const ov_set<Key, Compare> ©);
|
INLINE ov_set<Key, Compare> &operator = (const ov_set<Key, Compare> ©);
|
||||||
|
|
||||||
INLINE iterator insert(iterator position, const value_type &key);
|
INLINE ITERATOR insert(ITERATOR position, const VALUE_TYPE &key0);
|
||||||
INLINE pair<iterator, bool> insert(const value_type &key);
|
INLINE pair<ITERATOR, bool> insert(const VALUE_TYPE &key0);
|
||||||
|
|
||||||
INLINE void sort();
|
INLINE void sort();
|
||||||
};
|
};
|
||||||
@ -251,28 +301,12 @@ public:
|
|||||||
template<class Key, class Compare = less<Key> >
|
template<class Key, class Compare = less<Key> >
|
||||||
class ov_multiset : public ordered_vector<Key, Compare> {
|
class ov_multiset : public ordered_vector<Key, Compare> {
|
||||||
public:
|
public:
|
||||||
// The Intel compiler doesn't seem to inherit these typedefs
|
|
||||||
// completely--it gets confused in certain cases. We'll make it
|
|
||||||
// explicit.
|
|
||||||
typedef ordered_vector<Key, Compare>::key_type key_type;
|
|
||||||
typedef ordered_vector<Key, Compare>::value_type value_type;
|
|
||||||
typedef ordered_vector<Key, Compare>::reference reference;
|
|
||||||
typedef ordered_vector<Key, Compare>::const_reference const_reference;
|
|
||||||
typedef ordered_vector<Key, Compare>::key_compare key_compare;
|
|
||||||
typedef ordered_vector<Key, Compare>::value_compare value_compare;
|
|
||||||
typedef ordered_vector<Key, Compare>::iterator iterator;
|
|
||||||
typedef ordered_vector<Key, Compare>::const_iterator const_iterator;
|
|
||||||
typedef ordered_vector<Key, Compare>::reverse_iterator reverse_iterator;
|
|
||||||
typedef ordered_vector<Key, Compare>::const_reverse_iterator const_reverse_iterator;
|
|
||||||
typedef ordered_vector<Key, Compare>::difference_type difference_type;
|
|
||||||
typedef ordered_vector<Key, Compare>::size_type size_type;
|
|
||||||
|
|
||||||
INLINE ov_multiset(const Compare &compare = Compare());
|
INLINE ov_multiset(const Compare &compare = Compare());
|
||||||
INLINE ov_multiset(const ov_multiset<Key, Compare> ©);
|
INLINE ov_multiset(const ov_multiset<Key, Compare> ©);
|
||||||
INLINE ov_multiset<Key, Compare> &operator = (const ov_multiset<Key, Compare> ©);
|
INLINE ov_multiset<Key, Compare> &operator = (const ov_multiset<Key, Compare> ©);
|
||||||
|
|
||||||
INLINE iterator insert(iterator position, const value_type &key);
|
INLINE ITERATOR insert(ITERATOR position, const VALUE_TYPE &key);
|
||||||
INLINE iterator insert(const value_type &key);
|
INLINE ITERATOR insert(const VALUE_TYPE &key);
|
||||||
|
|
||||||
INLINE void sort();
|
INLINE void sort();
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user