Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Tools Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWSortedVector

Module:  Essential Tools Module   Group:  RWCollectable Classes


RWSortedVectorRWOrderedRWSequenceable... ...RWCollectionRWCollectable

Local Index

Members

Synopsis

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

Description

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.

Persistence

Polymorphic

Example

Program output:

Public Constructors

RWSortedVector(size_t size = RW_DEFAULT_CAPACITY);

Public Member Operators

bool
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
clear();
virtual void
clearAndDestroy();
virtual int
compareTo(const RWCollectable* a) const;
virtual bool
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 bool
isEmpty() const;
virtual bool
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);
RWCollectable*
removeAt(size_t index);


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, 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.