A value-based collection of values implemented as a vector. More...
#include <rw/tvvector.h>
Inherited by RWClassicTValOrderedVector< T > [private]
.
Public Types | |
typedef const_pointer | const_iterator |
typedef const value_type * | const_pointer |
typedef const value_type & | const_reference |
typedef std::reverse_iterator< const_iterator > | const_reverse_iterator |
typedef ptrdiff_t | difference_type |
typedef pointer | iterator |
typedef value_type * | pointer |
typedef value_type & | reference |
typedef std::reverse_iterator< iterator > | reverse_iterator |
typedef size_t | size_type |
typedef T | value_type |
Related Functions | |
(Note that these are not member functions.) | |
template<class T > | |
bool | operator!= (const RWTValVector< T > &lhs, const RWTValVector< T > &rhs) |
template<class T > | |
bool | operator< (const RWTValVector< T > &lhs, const RWTValVector< T > &rhs) |
template<class T > | |
bool | operator<= (const RWTValVector< T > &lhs, const RWTValVector< T > &rhs) |
template<class T > | |
bool | operator== (const RWTValVector< T > &lhs, const RWTValVector< T > &rhs) |
template<class T > | |
bool | operator> (const RWTValVector< T > &lhs, const RWTValVector< T > &rhs) |
template<class T > | |
bool | operator>= (const RWTValVector< T > &lhs, const RWTValVector< T > &rhs) |
Class RWTValVector is a simple parameterized vector of objects of type T
. It is most useful when you know precisely how many objects have to be held in the collection. If the intention is to "insert" an unknown number of objects, then class RWTValOrderedVector may be a better choice.
The class T
must have:
T::T(const T&)
or equivalent),T::operator=(const T&
or equivalent), andProgram output (if this is run on June 19, 2009):
typedef const_pointer RWTValVector< T >::const_iterator |
A type that provides a const
random-access iterator over the elements in the container.
typedef const value_type* RWTValVector< T >::const_pointer |
A type that provides a const
pointer to an element in the container.
typedef const value_type& RWTValVector< T >::const_reference |
A type that provides a const
reference to an element in the container.
typedef std::reverse_iterator<const_iterator> RWTValVector< T >::const_reverse_iterator |
A type that provides a const
random-access, reverse-order iterator over the elements in the container.
typedef ptrdiff_t RWTValVector< T >::difference_type |
A signed integral type used to indicate the distance between two valid iterators on the same container.
typedef pointer RWTValVector< T >::iterator |
A type that provides a random-access iterator over the elements in the container.
typedef value_type* RWTValVector< T >::pointer |
A type that provides a pointer to an element in the container.
typedef value_type& RWTValVector< T >::reference |
A type that provides a reference to an element in the container.
typedef std::reverse_iterator<iterator> RWTValVector< T >::reverse_iterator |
A type that provides a random-access, reverse-order iterator over the elements in the container.
typedef size_t RWTValVector< T >::size_type |
An unsigned integral type used for counting the number of elements in the container.
typedef T RWTValVector< T >::value_type |
A type representing the container's data type.
|
inline |
Constructs an empty vector of length zero.
|
inline |
Constructs a vector of length n. The values of the elements are set by the default constructor of class value_type.
RWTValVector< T >::RWTValVector | ( | size_type | n, |
const_reference | ival | ||
) |
Constructs a vector of length n, with each element initialized to the value ival.
RWTValVector< T >::RWTValVector | ( | const RWTValVector< T > & | rhs | ) |
Constructs self as a copy of rhs. Each element in rhs is copied into self.
RWTValVector< T >::RWTValVector | ( | RWTValVector< T > && | rhs | ) |
Move constructor. The constructed vector takes ownership of the data owned by rhs.
|
inline |
Copies each element in the range [first, last) into self, replacing any existing items.
InputIterator
is an input iterator type that points to elements that are convertible to value_type objects.
|
inline |
Calls the destructor for every element in self.
|
inline |
Invokes the function pointer fn on each item in the collection. Client data may be passed through parameter d.
|
inline |
Invokes the function pointer fn on each item in the collection. Client data may be passed through parameter d.
|
inline |
Copies each element in the range [first, last) into self, replacing any existing items.
InputIterator
is an input iterator type that points to elements that are convertible to value_type objects.
|
inline |
Returns a reference to the i th element of self.
RWBoundsErr | Thrown if index i is not between 0 and one less than the number of entries in self. |
|
inline |
Returns a reference to the i th element of self.
RWBoundsErr | Thrown if index i is not between 0 and one less than the number of entries in self. |
|
inline |
Returns an iterator referring to the first element in the container.
If the container is empty, returns end().
|
inline |
Returns an iterator referring to the first element in the container.
If the container is empty, returns end().
|
inline |
Returns an iterator referring to the first element in the container.
If the container is empty, returns end().
|
inline |
Returns an iterator referring to the element after the last element in the container.
Dereferencing the iterator returned by this function results in undefined behavior.
|
inline |
Clears the collection by removing all items from self. Each item has its destructor called.
|
inline |
Returns true
if there exists an element t
in self such that the expression ((*fn)(t,d))
is true
, otherwise returns false
. Client data may be passed through parameter d.
|
inline |
Returns true
if there exists an element t
in self such that the expression (t == a)
is true
, otherwise returns false
.
|
inline |
Returns an iterator referring to the last element in the container.
If the container is empty, returns rend().
|
inline |
Returns an iterator referring to the element before the first element in the container.
Dereferencing the iterator returned by this function results in undefined behavior.
|
inline |
Returns a pointer to the first element of the vector. The value returned is undefined if the vector is empty.
|
inline |
Returns a pointer to the first element of the vector. The value returned is undefined if the vector is empty.
|
inline |
Returns an iterator referring to the element after the last element in the container.
Dereferencing the iterator returned by this function results in undefined behavior.
|
inline |
Returns an iterator referring to the element after the last element in the container.
Dereferencing the iterator returned by this function results in undefined behavior.
|
inline |
Returns the number of elements in self.
|
inline |
If there exists an element t
in self such that the expression ((*fn)(t,d))
is true
, assigns t
to k and returns true
. Otherwise, returns false
and leaves the value of k unchanged. Client data may be passed through parameter d.
|
inline |
If there exists an element t
in self such that the expression (t == a)
is true
, assigns t
to k and returns true
. Otherwise, returns false
and leaves the value of k unchanged.
|
inline |
Returns a reference to the first item in the collection.
Calling this function on an empty collection results in undefined behavior.
|
inline |
Returns a reference to the first item in the collection.
Calling this function on an empty collection results in undefined behavior.
|
inline |
Returns the position of the first item t
in self such that (t == a), or returns RW_NPOS if no such item exists.
|
inline |
Returns the position of the first item t
in self such that ((*fn)(t,d))
is true
, or returns RW_NPOS if no such item exists. Client data may be passed through parameter d.
|
inline |
Returns true
if there are no items in the collection, otherwise false
.
|
inline |
Returns a reference to the last item in the collection.
Calling this function on an empty collection results in undefined behavior.
|
inline |
Returns a reference to the last item in the collection.
Calling this function on an empty collection results in undefined behavior.
|
inline |
Returns the number of elements in self.
|
inline |
Returns a reference to the maximum element in the collection. Type T
must have well-defined less-than semantics (T::operator<(const T&)
or equivalent).
|
inline |
Returns a reference to the maximum element in the collection. Type T
must have well-defined less-than semantics (T::operator<(const T&)
or equivalent).
|
inline |
Returns a reference to the minimum element in the collection. Type T
must have well-defined less-than semantics (T::operator<(const T&)
or equivalent).
|
inline |
Returns a reference to the minimum element in the collection. Type T
must have well-defined less-than semantics (T::operator<(const T&)
or equivalent).
|
inline |
Returns the number of elements t
in self such that the expression ((*fn)(t,d))
is true
. Client data may be passed through parameter d.
|
inline |
Returns the number of elements t
in self such that the expression (t == a)
is true
.
|
inline |
Returns a reference to the i th value in the vector. Index i should be between 0
and one less than the number of entries, otherwise the results are undefined.
|
inline |
Returns a reference to the i th value in the vector. Index i should be between 0
and one less than the number of entries, otherwise the results are undefined.
RWTValVector<T>& RWTValVector< T >::operator= | ( | const RWTValVector< T > & | rhs | ) |
Sets self to the same length as rhs and then copies all elements of rhs into self.
RWTValVector<T>& RWTValVector< T >::operator= | ( | RWTValVector< T > && | rhs | ) |
Move assignment. Self takes ownership of the data owned by rhs.
RWTValVector<T>& RWTValVector< T >::operator= | ( | const_reference | ival | ) |
Sets all elements in self to the value ival.
|
inline |
Returns a reference to the i th value in the vector.
RWBoundsErr | Thrown if index i is not between 0 and one less than the number of entries in self. |
|
inline |
Returns a reference to the i th value in the vector.
RWBoundsErr | Thrown if index i is not between 0 and one less than the number of entries in self. |
|
inline |
Returns an iterator referring to the last element in the container.
If the container is empty, returns rend().
|
inline |
Returns an iterator referring to the last element in the container.
If the container is empty, returns rend().
|
inline |
Returns an iterator referring to the element before the first element in the container.
Dereferencing the iterator returned by this function results in undefined behavior.
|
inline |
Returns an iterator referring to the element before the first element in the container.
Dereferencing the iterator returned by this function results in undefined behavior.
|
inline |
Replaces all elements t
in self such that the expression ((*fn)(t,d))
is true
. Returns the number of items replaced. Client data may be passed through parameter d.
|
inline |
Replaces all elements t
in self with newVal such that the expression (t == oldVal)
is true
. Returns the number of items replaced.
void RWTValVector< T >::reshape | ( | size_type | N | ) |
Changes the length of the vector to N. If this increases the length of the vector, then the initial value of the additional elements is set by the default constructor of value_type.
|
inline |
Sorts the collection using the less-than operator to compare elements.
void RWTValVector< T >::swap | ( | RWTValVector< T > & | rhs | ) |
Swaps the data owned by self with the data owned by rhs.
|
related |
Equivalent to !(lhs == rhs)
.
|
related |
Returns true
if lhs is lexicographically less than rhs, otherwise false
. Assumes that type T
has well-defined less-than semantics.
|
related |
Equivalent to !(rhs < lhs)
.
|
related |
Returns true
if lhs and rhs are equal, otherwise false
. Two collections are equal if both have the same number of entries, and iterating through both collections produces individual elements that, in turn, compare equal to each other.
|
related |
Equivalent to (rhs < lhs)
.
|
related |
Equivalent to !(lhs < rhs)
.
Copyright © 2021 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |