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

RWGOrderedVector(val)

Module:  Essential Tools Module   Group:  Generic


Does not inherit

Local Index

Members

Synopsis

#include <rw/gordvec.h>
declare(RWGVector,val)
declare(RWGOrderedVector,val)
implement(RWGVector,val)
implement(RWGOrderedVector,val)
RWGOrderedVector(val) v;// Ordered vector of objects of val val.

Description

Class RWGOrderedVector(val) represents an ordered collection of objects of val val. Objects are ordered by the order of insertion and are accessible by index. Duplicates are allowed. RWGOrderedVector(val) is implemented as a vector, using macros defined in the standard C++ header file <generic.h>.


NOTE -- RWGOrderedVector is deprecated. Please use RWTValOrderedVector or RWTPtrOrderedVector.

Note that it is a value-based collection: items are copied in and out of the collection.

The class val must have:

To use this class you must declare and implement its base class as well as the class itself. For example, here is how you declare and implement an ordered collection of doubles:

For each val of RWGOrderedVector you must include one (and only one) call to the macro implement somewhere in your code for both the RWGOrderedVector itself and for its base class RWGVector.

Persistence

None

Example

Here's an example that uses an ordered vector of RWCStrings.

Program output:

Public Constructors

RWGOrderedVector(val)(size_t capac=RWDEFAULT_CAPACITY);

Public Member Functions

val
operator()(size_t i) const;
val&
operator()(size_t i);
val
operator[](size_t i) const;
val&
operator[](size_t i);
void
clear();
const val*
data() const;
size_t
entries() const;
size_t
index(val item) const;
void
insert(val item);
void
insertAt(size_t indx, val item);
RWBoolean
isEmpty() const;
void
size_t
length() const;
val
pop();
void
push(val);
removeAt(size_t indx);
void
resize(size_t newCapacity);


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.