#include <rwsf/core/Vector.h>
This class is deprecated. Please use std::vector instead.
This class maintains a collection of values, implemented as a vector.
Vector();
Constructs an empty vector.
Vector(size_t n, const T& ival);
Constructs a vector with n elements, each initialized to ival.
Vector(size_t capac);
Constructs an empty vector with capac elements.
T& operator()(size_type i); const T& operator()(size_type i) const;
Returns a reference to the ith element of self. Index i should be between 0 and one less then the number of entries, otherwise the results are undefined -- no bounds checking is performed.
T& operator[](size_type i); const T& operator[](size_type i) const;
Returns a reference to the ith element of self. Index i must be between 0 and one less then the number of entries in self, otherwise the function throws an exception of type rwsf::OutOfBoundsException.
operator std::vector<T>() const;
Conversion operator. Converts an rwsf::Vector instance to a std::vector value.
void append(const T& val);
Adds the item val to the end of the collection.
append(const Vector<T>& values);
Adds the items in values to the end of the collection.
T& at(size_type i); const T& at(size_type i) const;
Returns a reference to the ith element of self. Index i must be between 0 and one less then the number of entries in self, otherwise the function throws an exception of type rwsf::OutOfBoundsException.
void clear();
Clears the collection by removing all items from self. Each item will have its destructor called.
bool contains(const T& a) const;
Returns true if there exists an element t in self such that the expression(t == a) is true, otherwise returns false.
const T* data() const;
Returns a pointer to the first element of the vector.
size_t entries() const;
Returns the number of elements in self.
bool find(const T& a, T& ret) const;
If there exists an element p in self such that the expression (p == a) is true, assigns p to ret and returns true. Otherwise, returns false and leaves the value of ret unchanged.
T* first(); const T& first() const;
Returns a reference to the first element of self.
size_t index(const T& p) const;
Returns the position of the first item t in self such that (t == p), or returns RWSF_NPOS if no such item exists.
bool insert(const T& val);
Adds the item val to the end of the collection. Returns true.
void insertAt(size_t i, const T& a);
Inserts the item a in front of the item at position i in self. This position must be between 0 and the number of entries in the collection, otherwise the function throws an exception of type rwsf::OutOfBoundsException.
bool isEmpty() const;
Returns true if there are no items in the collection, false otherwise.
T& last(); const T& last() const;
Returns a reference to the last item in the collection.
size_t length() const;
Returns the number of elements in self.
virtual size_t occurrencesOf(const T& a) const;
Returns the number of elements t in self such that the expression (t == a) is true.
void prepend(const T& val);
Adds the item val to the beginning of the collection.
virtual bool remove(const T& p);
Removes the first element t in self such that the expression (t == p) is true and returns true. Returns false if there is no such element.
virtual size_t removeAll(const T& p);
Removes all elements t in self such that the expression (t == p) is true. Returns the number of items removed.
T removeAt(size_t i);
Removes and returns the item at position i in self. This position must be between 0 and one less then the number of entries in the collection, otherwise the function throws an exception of type rwsf::OutOfBoundsException.
T removeFirst();
Removes and returns the first item in the collection.
T removeLast();
Removes and returns the last item in the collection.
void resize(size_t N);
Modifies the capacity of the vector to be at least as large as N. The function has no effect if the capacity is already as large as N.
template <class T> bool operator==(const Vector<T>& lhs, const Vector<T>& rhs);
If the lhs is equal to rhs, returns true; otherwise, false. Two collections are equal if both have the same number of entries, and iterating through both collections produces, in turn, individual elements that compare equal to each other.
©2004-2007 Copyright Quovadx, Inc. All Rights Reserved.
Quovadx and Rogue Wave are registered trademarks and HydraSDO is a trademark 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.