SourcePro C++ 13.0 |
SourcePro® C++ API Reference Guide |
Product Documentation: SourcePro C++ Documentation Home |
Represents a group of ordered items. More...
#include <rw/sortvec.h>
Private Member Functions | |
virtual RWCollectable * | append (RWCollectable *a) |
virtual RWCollectable *& | at (size_t) |
virtual RWCollectable * | insertAt (size_t, RWCollectable *) |
virtual RWCollectable * | prepend (RWCollectable *) |
Related Functions | |
(Note that these are not member functions.) | |
typedef RWOrderedIterator | RWSortedVectorIterator |
Additional Inherited Members | |
Static Public Member Functions inherited from RWCollectable | |
static RWClassID | classID (const RWStringID &name) |
static RWClassID | classIsA () |
static bool | isAtom (RWClassID id) |
static RWspace | nilStoreSize () |
Static Public Attributes inherited from RWCollection | |
static size_t | DEFAULT_CAPACITY |
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 using RWBinaryTree. However, insertions are slower in the center of the collection.
Polymorphic
Program output:
RWSortedVector::RWSortedVector | ( | size_t | size = RWCollection::DEFAULT_CAPACITY | ) |
Constructs an empty RWSortedVector that has an initial capacity of size items. The capacity will be increased automatically as needed.
|
inline |
Copy constructor. Makes a shallow copy of sv.
|
inline |
Move constructor. The constructed RWSortedVector takes ownership of the data owned by sv.
|
privatevirtual |
|
virtual |
Allows access to the i th element of the collection. The return value cannot be used as an lvalue. The index i must be between zero and the number of items in the collection less one, or an exception of type RWBoundsErr will be thrown.
Reimplemented from RWOrdered.
|
privatevirtual |
Allows access to the i th element of the collection. The return value can be used as an lvalue. The index i must be between zero and the number of items in the collection less one, or the function throws an exception of type RWBoundsErr.
Reimplemented from RWOrdered.
|
virtual |
Performs a binary search to return the index of the first item that compares equal to the target item, or RW_NPOS if no such item can be found.
Reimplemented from RWOrdered.
|
virtual |
|
privatevirtual |
Adds a new item to the collection at position indx. The item previously at position i
is moved to i+1
, etc. The index indx must be between 0
and the number of items in the collection, or an exception of type RWBoundsErr will be thrown.
Reimplemented from RWOrdered.
|
virtual |
Returns __RWSORTEDVECTOR
, i.e. a class identifier, that identifies this object's class.
Reimplemented from RWOrdered.
|
virtual |
Returns true
or false
based on operator==().
Reimplemented from RWOrdered.
|
virtual |
Allocates a new object off the heap of the same type as self and returns a pointer to it. You are responsible for deleting the object when done with it.
Reimplemented from RWOrdered.
|
virtual |
|
inline |
Returns the i th element in the collection. Bounds checking is enabled by defining the preprocessor directive RWBOUNDS_CHECK
before including the header file <rw/sortvec.h>
. In this case, if i is out of range, an exception of type RWBoundsErr is thrown. The return value cannot be used as an lvalue.
|
inline |
Assignment operator. Makes a shallow copy of o.
|
inline |
Move assignment. Self takes ownership of the data owned by sv.
|
inline |
Returns true
if for every item in self, the corresponding item in sv at the same index isEqual(). The two collections must also have the same number of members.
|
inline |
Returns the i th element in the collection. If i is out of range, an exception of type RWBoundsErr is thrown. The return value cannot be used as an lvalue.
|
privatevirtual |
|
related |
RWSortedVectorIterator is a typedef for RWOrderedIterator. For information on how to use it, please see RWOrderedIterator.
Copyright © 2014 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.
Provide feedback to Rogue Wave about its documentation.