MIP_SDK
latest-2-g34f3e39
MicroStrain Communications Library for embedded systems
|
Vector is a wrapper around an array of some type T, usually float or double. More...
#include <common.hpp>
Public Types | |
typedef T | Array[N] |
Public Member Functions | |
Vector () | |
Default constructor, no initialization. More... | |
template<typename U > | |
Vector (U value) | |
template<typename U > | |
Vector (const U(&ptr)[N]) | |
template<typename U , size_t M> | |
Vector (const U(&ptr)[M]) | |
template<typename U > | |
Vector (const U *ptr, size_t n) | |
template<typename U , typename V , typename... Rest> | |
Vector (U u, V v, Rest... rest) | |
Vector (const Vector &)=default | |
Copy constructor. More... | |
Vector & | operator= (const Vector &)=default |
Assignment operator. More... | |
template<typename U > | |
Vector & | operator= (const Vector< U, N > &other) |
Assignment operator from different type (e.g. float to double). More... | |
operator T* () | |
operator const T * () const | |
Array & | data () |
Explicitly convert to a C-style array. More... | |
const Array & | data () const |
template<typename U > | |
void | fill (U value) |
Fill all elements with a given value. More... | |
template<typename U > | |
void | copyFrom (const U *ptr, size_t n) |
size_t | size () const |
Get the size of the array. More... | |
Vector is a wrapper around an array of some type T, usually float or double.
Implicit conversion to/from C-style pointers is provided to allow simple integration with code using plain arrays.
typedef T mip::Vector< T, N >::Array[N] |
|
inline |
Default constructor, no initialization.
Set all elements to this value (typically 0).
value |
|
inline |
Construct from a C array of known size.
ptr |
|
inlineexplicit |
Construct from a C array of different size (smaller or larger vector).
ptr |
|
inlineexplicit |
Construct from a pointer and size.
ptr | Pointer to data to copy. Can be NULL if n==0. |
n | Number of elements to copy. Clamped to N. |
|
inline |
Construct from individual elements or a braced init list.
u | The first value (typically X). |
v | The value value (typically Y). |
rest | Additional optional values (typically none, Z, or Z and W). |
|
default |
Copy constructor.
|
inline |
Copy data from a pointer and size to this vector.
ptr | Pointer to data. Can be NULL if n==0. |
n | Number of elements in ptr. Clamped to N. |
|
inline |
Explicitly convert to a C-style array.
|
inline |
|
inline |
Fill all elements with a given value.
|
inline |
|
inline |
|
default |
Assignment operator.
|
inline |
Assignment operator from different type (e.g. float to double).
|
inline |
Get the size of the array.