Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Tools Module Reference Guide


Module:  Essential Tools Module   Group:  RWCollectable

RWSortedVectorRWOrderedRWSequenceable... ...RWCollectionRWCollectable

Local Index



#include <rw/sortvec.h>
RWSortedVector a;


Class RWSortedVector represents a group of ordered items, internally sorted by the compareTo() function and accessible by an index number. Duplicates are allowed. An object stored by RWSortedVector must inherit from the abstract base class RWCollectable. An insertion sort is used to maintain the vector in sorted order.

Because class RWSortedVector is implemented as a vector of pointers, traversing the collection is more efficient than with class RWBinaryTree. However, insertions are slower in the center of the collection.

Note that because the vector is sorted, you must not modify elements contained in the vector in such a way as to invalidate the ordering.




Program output:

Public Constructors

RWSortedVector(size_t size = RWDEFAULT_CAPACITY);

Public Member Operators

operator==(const RWSortedVector& sv) const;
const RWCollectable*
operator[](size_t i);
const RWCollectable*
operator()(size_t i);

Public Member Functions

virtual void
apply(RWapplyCollectable ap, void* x);
virtual const RWCollectable*
at(size_t i) const;
virtual RWspace
binaryStoreSize() const;
virtual void
virtual void
virtual int
compareTo(const RWCollectable* a) const;
virtual RWBoolean
contains(const RWCollectable* target) const;
virtual size_t
entries() const;
virtual RWCollectable*
find(const RWCollectable* target) const;
virtual RWCollectable*
first() const;
virtual unsigned
hash() const;
virtual size_t
index(const RWCollectable*) const;
virtual RWCollectable*
insert(RWCollectable* c);
virtual RWClassID
isA() const;
virtual RWBoolean
isEmpty() const;
virtual RWBoolean
isEqual(const RWCollectable* a) const;
virtual RWCollectable*
last() const;
virtual size_t
occurrencesOf(const RWCollectable* target) const;
virtual RWCollectable*
remove(const RWCollectable* target);
virtual void
removeAndDestroy(const RWCollectable* target);
removeAt(size_t index);

Previous fileTop of DocumentContentsIndex pageNext file

©2004 Copyright Quovadx, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Quovadx, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.