LTL
2.0.x
|
Vector whose length is known at compile time. More...
Inherits ltl::FVMemory< T, N, S >.
Public Types | |
enum | { static_size = 1 } |
Used by expression engine to decide which loops to unroll. More... | |
typedef T | value_type |
STL-compatible type definitions. More... | |
typedef FVIter< T, N, S > | iterator |
typedef FVIterConst< T, N, S > | const_iterator |
typedef T * | pointer |
typedef const T * | const_pointer |
typedef T & | reference |
typedef const T & | const_reference |
typedef std::size_t | size_type |
typedef std::ptrdiff_t | difference_type |
Public Member Functions | |
FVector () | |
default constructor More... | |
~FVector () | |
destructor More... | |
FVector (const FVector< T, N, S > &other) | |
copy constructor More... | |
FVector (T *const a) | |
FVector (const T t) | |
fill with value t . More... | |
template<class Expr > | |
FVector (const FVExprNode< Expr, N > &e) | |
construct from expression More... | |
ListInitializationSwitch < FVector< T, N, S > > | operator= (T x) |
Initialize with list of values or single value. More... | |
iterator | begin () |
return an iterator pointing to the first element. More... | |
const_iterator | begin () const |
return a const iterator pointing to the first element. More... | |
iterator | end () |
return an iterator pointing past the last element. More... | |
const_iterator | end () const |
return a const iterator pointing past the last element. More... | |
void | fill (const T x) |
fill with value x . More... | |
template<class T2 , int S2> | |
void | swap (FVector< T2, N, S2 > &other) |
swap values with other . More... | |
T * | data () |
Return a pointer to the data. More... | |
T * | data () const |
Return a const pointer to the data. More... | |
template<class Expr > | |
FVector< T, N, S > & | operator= (const FVExprNode< Expr, N > &e) |
operatorX= for expression rhs. More... | |
template<class Expr > | |
FVector< T, N, S > & | operator+= (const FVExprNode< Expr, N > &e) |
template<class Expr > | |
FVector< T, N, S > & | operator-= (const FVExprNode< Expr, N > &e) |
template<class Expr > | |
FVector< T, N, S > & | operator*= (const FVExprNode< Expr, N > &e) |
template<class Expr > | |
FVector< T, N, S > & | operator/= (const FVExprNode< Expr, N > &e) |
template<class Expr > | |
FVector< T, N, S > & | operator%= (const FVExprNode< Expr, N > &e) |
template<class Expr > | |
FVector< T, N, S > & | operator^= (const FVExprNode< Expr, N > &e) |
template<class Expr > | |
FVector< T, N, S > & | operator&= (const FVExprNode< Expr, N > &e) |
template<class Expr > | |
FVector< T, N, S > & | operator|= (const FVExprNode< Expr, N > &e) |
template<class Expr > | |
FVector< T, N, S > & | operator<<= (const FVExprNode< Expr, N > &e) |
template<class Expr > | |
FVector< T, N, S > & | operator>>= (const FVExprNode< Expr, N > &e) |
template<class T2 , int S2> | |
FVector< T, N, S > & | operator= (const FVector< T2, N, S2 > &v) |
operatorX for FVector rhs. More... | |
FVector< T, N, S > & | operator= (const FVector< T, N, S > &v) |
template<class T2 , int S2> | |
FVector< T, N, S > & | operator+= (const FVector< T2, N, S2 > &v) |
template<class T2 , int S2> | |
FVector< T, N, S > & | operator-= (const FVector< T2, N, S2 > &v) |
template<class T2 , int S2> | |
FVector< T, N, S > & | operator*= (const FVector< T2, N, S2 > &v) |
template<class T2 , int S2> | |
FVector< T, N, S > & | operator/= (const FVector< T2, N, S2 > &v) |
template<class T2 , int S2> | |
FVector< T, N, S > & | operator%= (const FVector< T2, N, S2 > &v) |
template<class T2 , int S2> | |
FVector< T, N, S > & | operator^= (const FVector< T2, N, S2 > &v) |
template<class T2 , int S2> | |
FVector< T, N, S > & | operator&= (const FVector< T2, N, S2 > &v) |
template<class T2 , int S2> | |
FVector< T, N, S > & | operator|= (const FVector< T2, N, S2 > &v) |
template<class T2 , int S2> | |
FVector< T, N, S > & | operator<<= (const FVector< T2, N, S2 > &v) |
template<class T2 , int S2> | |
FVector< T, N, S > & | operator>>= (const FVector< T2, N, S2 > &v) |
FVector< T, N, S > & | operator+= (const T t) |
operatorX= for scalar rhs. More... | |
FVector< T, N, S > & | operator-= (const T t) |
FVector< T, N, S > & | operator*= (const T t) |
FVector< T, N, S > & | operator/= (const T t) |
FVector< T, N, S > & | operator%= (const T t) |
FVector< T, N, S > & | operator^= (const T t) |
FVector< T, N, S > & | operator&= (const T t) |
FVector< T, N, S > & | operator|= (const T t) |
FVector< T, N, S > & | operator<<= (const T t) |
FVector< T, N, S > & | operator>>= (const T t) |
T | operator[] (const int i) const |
Access elements with zero-based index i . More... | |
T & | operator[] (const int i) |
Access elements with zero-based index i . More... | |
T | operator() (const int i) const |
Access elements with one-based index i . More... | |
T & | operator() (const int i) |
Access elements with one-based index i . More... | |
Static Public Member Functions | |
static int | length () |
return length of vector. More... | |
static int | minIndex () |
lowest possible index, always one. More... | |
static int | maxIndex () |
highest possible index, always N. More... | |
static size_type | size () |
STL return the length of the vector. More... | |
static bool | empty () |
STL empty() . Always false. More... | |
static size_type | max_size () |
STL: Maximum capacity. Always ==size() More... | |
Protected Attributes | |
T * | __data_ |
points to first element of data block for 0-based access More... | |
Friends | |
class | FVIter< T, N, S > |
class | FVIterConst< T, N, S > |
class | ListInitializationSwitch< FVector< T, N, S > > |
Related Functions | |
(Note that these are not member functions.) | |
template<class T , int N, int S> | |
ostream & | operator<< (ostream &os, const FVector< T, N, S > &x) |
template<class T , int N, int S> | |
istream & | operator>> (istream &is, FVector< T, N, S > &x) |
Vector whose length is known at compile time.
Can either have its own memory region or reference foreign memory, for example when representing a column-vector of a matrix
The template parameter S is a 'stride' for the foreign memory: when we reference a column vector we need a stride of M (if the matrix is MxN). Memory handling is encapsulated in the class FVMemory. To make life easier for the compiler/optimizer, there is a specialization of FVMemory with no stride at all and an own new embedded block of memory. This is indicated by S=0, which is also the default case.
FVector
does not require more memory than is necessary to store the N elements of the vector if S=0. If S>0, the size is exactly sizeof(T*)
.
FVector
provides operator() for 1-based access and operator[] for 0-based access. A full expression-templated engine for evaluating expressions involving ltl::FVectors is provided, as well as dot products between ltl::FVector and ltl::FMatrix objects, and scalar-valued reductions.
STL-compatible iterators and types.
typedef T ltl::FVector< T, N, S >::value_type |
STL-compatible type definitions.
typedef FVIter<T,N,S> ltl::FVector< T, N, S >::iterator |
typedef FVIterConst<T,N,S> ltl::FVector< T, N, S >::const_iterator |
typedef T* ltl::FVector< T, N, S >::pointer |
typedef const T* ltl::FVector< T, N, S >::const_pointer |
typedef T& ltl::FVector< T, N, S >::reference |
typedef const T& ltl::FVector< T, N, S >::const_reference |
typedef std::size_t ltl::FVector< T, N, S >::size_type |
typedef std::ptrdiff_t ltl::FVector< T, N, S >::difference_type |
anonymous enum |
|
inline |
default constructor
|
inline |
destructor
ltl::FVector< T, N, S >::FVector | ( | const FVector< T, N, S > & | other | ) |
copy constructor
ltl::FVector< T, N, S >::FVector | ( | T *const | a | ) |
constructor taking a pointer to foreign memory. If S==0
, copy, else reference the foreign memory.
ltl::FVector< T, N, S >::FVector | ( | const T | t | ) |
fill with value t
.
ltl::FVector< T, N, S >::FVector | ( | const FVExprNode< Expr, N > & | e | ) |
construct from expression
|
inlinestatic |
STL return the length of the vector.
Functions needed for STL container conformance
|
inlinestatic |
STL empty()
. Always false.
|
inlinestatic |
STL: Maximum capacity. Always ==size()
|
inline |
Initialize with list of values or single value.
Assign values through initialization list. A bit more comlicated since we have to discriminate between A = 3; and A = 1, 2, 3, 4; which is done using ListInitializationSwitch which either calls ListInitializer
or FVector::fill()
.
|
inlinestatic |
return length of vector.
operator[] and operator() inherited from FVMemory
|
inlinestatic |
lowest possible index, always one.
Referenced by ltl::FVector< T, N, S >::operator>>().
|
inlinestatic |
highest possible index, always N.
Referenced by ltl::FVector< T, N, S >::operator>>().
|
inline |
return an iterator pointing to the first element.
|
inline |
return a const iterator pointing to the first element.
|
inline |
return an iterator pointing past the last element.
|
inline |
return a const iterator pointing past the last element.
void ltl::FVector< T, N, S >::fill | ( | const T | x | ) |
fill with value x
.
FVector<T,N,S>& ltl::FVector< T, N, S >::operator= | ( | const FVExprNode< Expr, N > & | e | ) |
operatorX=
for expression rhs.
FVector<T,N,S>& ltl::FVector< T, N, S >::operator+= | ( | const FVExprNode< Expr, N > & | e | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator-= | ( | const FVExprNode< Expr, N > & | e | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator*= | ( | const FVExprNode< Expr, N > & | e | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator/= | ( | const FVExprNode< Expr, N > & | e | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator%= | ( | const FVExprNode< Expr, N > & | e | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator^= | ( | const FVExprNode< Expr, N > & | e | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator&= | ( | const FVExprNode< Expr, N > & | e | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator|= | ( | const FVExprNode< Expr, N > & | e | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator<<= | ( | const FVExprNode< Expr, N > & | e | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator>>= | ( | const FVExprNode< Expr, N > & | e | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator= | ( | const FVector< T2, N, S2 > & | v | ) |
operatorX for FVector
rhs.
FVector<T,N,S>& ltl::FVector< T, N, S >::operator= | ( | const FVector< T, N, S > & | v | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator+= | ( | const FVector< T2, N, S2 > & | v | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator-= | ( | const FVector< T2, N, S2 > & | v | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator*= | ( | const FVector< T2, N, S2 > & | v | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator/= | ( | const FVector< T2, N, S2 > & | v | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator%= | ( | const FVector< T2, N, S2 > & | v | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator^= | ( | const FVector< T2, N, S2 > & | v | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator&= | ( | const FVector< T2, N, S2 > & | v | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator|= | ( | const FVector< T2, N, S2 > & | v | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator<<= | ( | const FVector< T2, N, S2 > & | v | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator>>= | ( | const FVector< T2, N, S2 > & | v | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator+= | ( | const T | t | ) |
operatorX= for scalar rhs.
FVector<T,N,S>& ltl::FVector< T, N, S >::operator-= | ( | const T | t | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator*= | ( | const T | t | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator/= | ( | const T | t | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator%= | ( | const T | t | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator^= | ( | const T | t | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator&= | ( | const T | t | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator|= | ( | const T | t | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator<<= | ( | const T | t | ) |
FVector<T,N,S>& ltl::FVector< T, N, S >::operator>>= | ( | const T | t | ) |
void ltl::FVector< T, N, S >::swap | ( | FVector< T2, N, S2 > & | other | ) |
swap values with other
.
|
inlineinherited |
Access elements with zero-based index i
.
|
inlineinherited |
Access elements with zero-based index i
.
|
inlineinherited |
Access elements with one-based index i
.
|
inlineinherited |
Access elements with one-based index i
.
|
inlineinherited |
Return a pointer to the data.
|
inlineinherited |
Return a const pointer to the data.
|
friend |
Referenced by ltl::FVector< bool, NPAR >::begin(), and ltl::FVector< bool, NPAR >::end().
|
friend |
Referenced by ltl::FVector< bool, NPAR >::begin(), and ltl::FVector< bool, NPAR >::end().
|
friend |
|
related |
Write ltl::FVector to ascii stream. Compatible with opertor>>
.
|
related |
Read ltl::FVector from ascii stream. Compatible with operator<<
.
References ltl::FVector< T, N, S >::maxIndex(), and ltl::FVector< T, N, S >::minIndex().
|
protectedinherited |
points to first element of data block for 0-based access
Referenced by ltl::FVMemory< bool, N, S >::data(), ltl::FVMemory< T, N, 0 >::data(), ltl::FVMemory< bool, N, S >::operator()(), ltl::FVMemory< T, N, 0 >::operator()(), ltl::FVMemory< bool, N, S >::operator[](), and ltl::FVMemory< T, N, 0 >::operator[]().