Tiny Vector Matrix library using Expression Templates | Sourceforge Project Page |
#include <tvmet/CommaInitializer.h>
Collaboration diagram for tvmet::CommaInitializer< Obj, LEN >:
The comma operator is called when it appears next to an object of the type the comma is defined for. However, "operator," is not called for function argument lists, only for objects that are out in the open, separated by commas (Thinking C++ Ch.12: Operator comma).
This implementation uses the same technique as described in Todd Veldhuizen Techniques for Scientific C++ chapter 1.11 Comma overloading.
The initializer list is avaible after instanciation of the object, therefore use it like:
vector3d t; t = 1.0, 2.0, 3.0;
For matrizes the initilization is done row wise.
If the comma separted list of values longer then the size of the vector or matrix a compile time error will occour. Otherwise the pending values will be written random into the memory.
Public Types | |
typedef Obj::value_type | value_type |
typedef value_type * | iterator |
Public Member Functions | |
CommaInitializer (const CommaInitializer &rhs) | |
CommaInitializer (Obj &obj, value_type x) | |
Constructor used by Vector or Matrix operator(value_type rhs). | |
~CommaInitializer () | |
Destructs and assigns the comma separated value. | |
Initializer< value_type, 2 > | operator, (value_type rhs) |
Overloaded comma operator, called only once for the first occoured comma. | |
void | disable () const |
Private Member Functions | |
CommaInitializer () | |
CommaInitializer & | operator= (const CommaInitializer &) |
Private Attributes | |
Obj & | m_object |
value_type | m_data |
bool | m_wipeout_on_destruct |
Classes | |
class | Initializer |
Helper fo recursive overloaded comma operator. More... |
typedef Obj::value_type tvmet::CommaInitializer< Obj, LEN >::value_type |
typedef value_type* tvmet::CommaInitializer< Obj, LEN >::iterator |
tvmet::CommaInitializer< Obj, LEN >::CommaInitializer | ( | ) | [private] |
tvmet::CommaInitializer< Obj, LEN >::CommaInitializer | ( | const CommaInitializer< Obj, LEN > & | rhs | ) | [inline] |
tvmet::CommaInitializer< Obj, LEN >::CommaInitializer | ( | Obj & | obj, | |
value_type | x | |||
) | [inline] |
tvmet::CommaInitializer< Obj, LEN >::~CommaInitializer | ( | ) | [inline] |
Destructs and assigns the comma separated value.
CommaInitializer& tvmet::CommaInitializer< Obj, LEN >::operator= | ( | const CommaInitializer< Obj, LEN > & | ) | [private] |
CommaInitializer< Obj, LEN >::template Initializer< typename Obj::value_type, 2 > tvmet::CommaInitializer< Obj, LEN >::operator, | ( | value_type | rhs | ) | [inline] |
Overloaded comma operator, called only once for the first occoured comma.
This means the first value is assigned by operator=() and the 2nd value after the comma. Therfore we call the Initializeroperator,() for the list starting after the 2nd.
void tvmet::CommaInitializer< Obj, LEN >::disable | ( | ) | const [inline] |
Obj& tvmet::CommaInitializer< Obj, LEN >::m_object [private] |
value_type tvmet::CommaInitializer< Obj, LEN >::m_data [private] |
bool tvmet::CommaInitializer< Obj, LEN >::m_wipeout_on_destruct [mutable, private] |
Author: |