Does not inherit
#include rwsf/core/Vector.h
This class maintains a collection of values, implemented as a vector.
Deprecated. Use std::vector instead.
Vector();
Constructs an empty vector.
Vector(size_t capac);
Constructs an empty vector with capac elements.
Vector(size_t n, const T & ival);
Constructs a vector with n elements, each initialized to ival.
virtual ~Vector();
Destructor
void append(const T & val);
Adds the item val to the end of the collection.
void append(const Vector< T > & values);
Adds the items in values to the end of the collection.
T & at(size_t i);
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.
const T & at(size_t 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 & p, 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();
Returns a reference to the first element of self.
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.
void insert(const T & val);
Adds the item val to the end of the collection.
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();
Returns a reference to the last item in the collection.
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.
size_t occurrencesOf(const T &) 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.
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.
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.
T & operator()(size_t i);
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 undefinedno bounds checking is performed.
const T & operator()(size_t 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 undefinedno bounds checking is performed.
T & operator[](size_t i);
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.
const T & operator[](size_t 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() const;
Conversion operator. Converts an rwsf::Vector instance to a std::vector value.
© Copyright Rogue Wave Software, Inc. All Rights Reserved. All Rights Reserved. Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. HydraExpress is a trademark of Rogue Wave Software, Inc. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.