#include <SgVector.h>
Inheritance diagram for SgVectorOf< T >:
Pointers cannot be 0.
Definition at line 365 of file SgVector.h.
Public Member Functions | |
T * | operator[] (int index) const |
Return const reference to element. | |
T * | Back () const |
Returns the last element of the vector. | |
bool | Contains (const T *element) const |
void | Include (const T *element) |
Push elt to the back of the vector unless it is already included. | |
bool | Exclude (const T *element) |
void | Exclude (const SgVectorOf< T > &vector) |
T * | Front () const |
Returns the first element of the vector. | |
bool | Insert (const T *element) |
void | PushFront (const T *element) |
void | PushBack (const T *element) |
T * | PopFront () |
Remove element[0] of the vector. | |
void *& | operator[] (int index) |
Return reference to element. | |
bool | operator== (const SgVector< void * > &rhs) const |
Compare whether the contents of two vectors are identical. | |
bool | operator!= (const SgVector &rhs) const |
Compare whether the contents of two vectors are not identical. | |
void * | BackAndPop () |
void | Clear () |
Remove all elements in this vector. | |
void | Concat (SgVector< void * > *tail) |
Push all of *tail to the back of this vector, and clear the *tail vector. | |
bool | Contains (const void *&elt) const |
Check if element is in vector. | |
void | DeleteAt (int index) |
delete element at specified index | |
bool | Exclude (const void *&elt) |
Remove the first occurence of element. | |
void | Exclude (const SgVector< void * > &vector) |
Exclude each element of vector from this vector. | |
int | Index (const void *&elt) const |
Find position of element. | |
void | Include (const void *&elt) |
Push elt to the back of the vector only if it is not included yet. | |
bool | Insert (const void *&elt) |
Includes the element in a ascending sorted vector at the right place. | |
bool | IsEmpty () const |
Return whether this vector contains zero elements. | |
bool | IsLength (int length) const |
Test whether a vector is as long as a given length. | |
bool | IsSorted (bool ascending=true) const |
Returns whether the vector is sorted in given order. | |
bool | IsSortedAndUnique (bool ascending=true) const |
Returns whether the vector is sorted and has no duplicates. | |
int | Length () const |
Return the number of elements in this vector. | |
void | LimitListLength (int limit) |
Cut off vector after at most length elements. | |
bool | MaxLength (int length) const |
Test whether a vector is shorter than or equal to a given length. | |
void | Merge (const SgVector< void * > &vector) |
Merges two sorted vectors into this. | |
bool | MinLength (int length) const |
Test whether a vector is as long as or longer than a given length. | |
bool | NonEmpty () const |
Return whether this vector contains more than zero elements. | |
void | PopBack () |
Remove the last element of the vector. | |
void | PushFront (const void *&elt) |
Insert element at the beginning of the vector. | |
void | PushBack (const void *&elt) |
Add a single element at the end of the vector. | |
void | PushBackList (const SgVector< void * > &vector) |
Push all elements from vector to the back of this. | |
bool | RemoveDuplicates () |
Removes all but the first copy of each element from the vector. | |
void | Reverse () |
void | SetTo (const void *&elt) |
Clear this vector and set it to contain only elt . | |
void | SetTo (const void **array, int count) |
Clear this vector and set it to contain the count elements from array[0] to array[count - 1] . | |
bool | SetsAreEqual (const SgVector< void * > &other) const |
Do vectors contain the same elements, possibly in different order? | |
void | Sort () |
void | SortedRemoveDuplicates () |
remove duplicates in a sorted vector | |
void | SwapWith (SgVector< void * > *vector) |
Swap the entire contents of this vector with *vector . | |
const void *& | TopNth (int index) const |
Returns the Nth-last element of the vector. | |
void | Union (const SgVector< void * > &set) |
Include all elements from set into this vector. | |
bool | UniqueElements () const |
Check for duplicate elements. | |
std::vector< void * > & | Vector () |
const std::vector< void * > & | Vector () const |
Static Private Member Functions | |
static void * | GetVoidPtr (const T *element) |
Conversion of element pointer to non-const void pointer. |
T* SgVectorOf< T >::Back | ( | ) | const |
Returns the last element of the vector.
Asserts if the vector is empty.
Reimplemented from SgVector< void * >.
Definition at line 375 of file SgVector.h.
void * SgVector< void * >::BackAndPop | ( | ) | [inherited] |
Definition at line 69 of file SgVector.h.
void SgVector< void * >::Clear | ( | ) | [inherited] |
Remove all elements in this vector.
Definition at line 78 of file SgVector.h.
Referenced by SgNode::PathToRoot(), SgGameReader::ReadGames(), and SgNode::ShortestPathTo().
Push all of *tail
to the back of this vector, and clear the *tail
vector.
Remark: this operation is efficient for lists but not so meaningful for vectors. PushBackList may be more appropriate in most cases.
bool SgVector< void * >::Contains | ( | const void * & | elt | ) | const [inherited] |
Check if element is in vector.
true
if elt
is included in this vector, false
if not. bool SgVectorOf< T >::Contains | ( | const T * | element | ) | const |
void SgVector< void * >::DeleteAt | ( | int | index | ) | [inherited] |
delete element at specified index
Exclude each element of vector
from this vector.
bool SgVector< void * >::Exclude | ( | const void * & | elt | ) | [inherited] |
Remove the first occurence of element.
If elt
is in the vector, remove the first occurence of elt
from the vector, and return true
. Otherwise do nothing and return false
.
void SgVectorOf< T >::Exclude | ( | const SgVectorOf< T > & | vector | ) |
Definition at line 400 of file SgVector.h.
bool SgVectorOf< T >::Exclude | ( | const T * | element | ) |
Definition at line 395 of file SgVector.h.
Referenced by SgPropList::MoveToFront(), and SgPropList::Remove().
T* SgVectorOf< T >::Front | ( | ) | const |
Returns the first element of the vector.
Asserts if the vector is empty.
Reimplemented from SgVector< void * >.
Definition at line 405 of file SgVector.h.
static void* SgVectorOf< T >::GetVoidPtr | ( | const T * | element | ) | [static, private] |
Conversion of element pointer to non-const void pointer.
Definition at line 451 of file SgVector.h.
Referenced by SgVectorOf< std::string >::Contains(), SgVectorOf< std::string >::Exclude(), SgVectorOf< std::string >::Insert(), SgVectorOf< std::string >::PushBack(), and SgVectorOf< std::string >::PushFront().
void SgVector< void * >::Include | ( | const void * & | elt | ) | [inherited] |
Push elt
to the back of the vector only if it is not included yet.
Definition at line 129 of file SgVector.h.
void SgVectorOf< T >::Include | ( | const T * | element | ) |
Push elt
to the back of the vector unless it is already included.
Definition at line 388 of file SgVector.h.
Referenced by SgPropList::Add().
int SgVector< void * >::Index | ( | const void * & | elt | ) | const [inherited] |
Find position of element.
elt
in the vector, in range 0..length-1
. Returns -1 if elt
is not in the vector. bool SgVector< void * >::Insert | ( | const void * & | elt | ) | [inherited] |
Includes the element in a ascending sorted vector at the right place.
Does nothing and returns false
if the element is already in the vector; returns true
if the element is inserted.
bool SgVectorOf< T >::Insert | ( | const T * | element | ) |
Definition at line 410 of file SgVector.h.
bool SgVector< void * >::IsEmpty | ( | ) | const [inherited] |
bool SgVector< void * >::IsLength | ( | int | length | ) | const [inherited] |
bool SgVector< void * >::IsSorted | ( | bool | ascending = true |
) | const [inherited] |
Returns whether the vector is sorted in given order.
bool SgVector< void * >::IsSortedAndUnique | ( | bool | ascending = true |
) | const [inherited] |
Returns whether the vector is sorted and has no duplicates.
int SgVector< void * >::Length | ( | ) | const [inherited] |
void SgVector< void * >::LimitListLength | ( | int | limit | ) | [inherited] |
Cut off vector after at most length
elements.
bool SgVector< void * >::MaxLength | ( | int | length | ) | const [inherited] |
Test whether a vector is shorter than or equal to a given length.
Definition at line 173 of file SgVector.h.
Merges two sorted vectors into this.
Equivalent to, but faster than:
for (SgVectorIterator<T> it(vector); it; ++it) Insert(*it);
bool SgVector< void * >::MinLength | ( | int | length | ) | const [inherited] |
Test whether a vector is as long as or longer than a given length.
Definition at line 187 of file SgVector.h.
bool SgVector< void * >::NonEmpty | ( | ) | const [inherited] |
Return whether this vector contains more than zero elements.
Definition at line 193 of file SgVector.h.
Compare whether the contents of two vectors are not identical.
Definition at line 55 of file SgVector.h.
Compare whether the contents of two vectors are identical.
Same length, and the same elements in the same sequence.
Definition at line 49 of file SgVector.h.
void * & SgVector< void * >::operator[] | ( | int | index | ) | [inherited] |
Return reference to element.
index | Position of element in range 0..length-1 . |
Definition at line 28 of file SgVector.h.
T* SgVectorOf< T >::operator[] | ( | int | index | ) | const |
Return const reference to element.
index | Position of element in range 0..length-1 . |
Reimplemented from SgVector< void * >.
Definition at line 370 of file SgVector.h.
void SgVector< void * >::PopBack | ( | ) | [inherited] |
Remove the last element of the vector.
The vector must not be empty.
T* SgVectorOf< T >::PopFront | ( | ) |
Remove element[0] of the vector.
The vector must not be empty.
Reimplemented from SgVector< void * >.
Definition at line 427 of file SgVector.h.
void SgVector< void * >::PushBack | ( | const void * & | elt | ) | [inherited] |
void SgVectorOf< T >::PushBack | ( | const T * | element | ) |
Definition at line 421 of file SgVector.h.
Referenced by SgPropTextList::AddStringAtPoint(), SgVectorOf< std::string >::Include(), SgNode::PathToRoot(), SgGameReader::ReadGames(), SgPropList::Remove(), SgPropTextList::SgPropTextList(), and SgNode::ShortestPathTo().
Push all elements from vector
to the back of this.
void SgVector< void * >::PushFront | ( | const void * & | elt | ) | [inherited] |
Insert element at the beginning of the vector.
void SgVectorOf< T >::PushFront | ( | const T * | element | ) |
bool SgVector< void * >::RemoveDuplicates | ( | ) | [inherited] |
Removes all but the first copy of each element from the vector.
After calling RemoveDuplicates()
, UniqueElements()
is true
.
void SgVector< void * >::Reverse | ( | ) | [inherited] |
Do vectors contain the same elements, possibly in different order?
void SgVector< void * >::SetTo | ( | const void * * | array, | |
int | count | |||
) | [inherited] |
Clear this vector and set it to contain the count
elements from array[0]
to array[count - 1]
.
If count
is zero, the vector is just cleared.
void SgVector< void * >::SetTo | ( | const void * & | elt | ) | [inherited] |
void SgVector< void * >::Sort | ( | ) | [inherited] |
void SgVector< void * >::SortedRemoveDuplicates | ( | ) | [inherited] |
remove duplicates in a sorted vector
const void * & SgVector< void * >::TopNth | ( | int | index | ) | const [inherited] |
Returns the Nth-last element of the vector.
It must exist.
Definition at line 267 of file SgVector.h.
Include all elements from set
into this vector.
Appends new elements at the end of this vector.
bool SgVector< void * >::UniqueElements | ( | ) | const [inherited] |
Check for duplicate elements.
true
if there are no duplicate elements in the vector. Useful for debugging. const std::vector<void * >& SgVector< void * >::Vector | ( | ) | const [inherited] |
Definition at line 293 of file SgVector.h.
std::vector<void * >& SgVector< void * >::Vector | ( | ) | [inherited] |
Definition at line 288 of file SgVector.h.