The blo Library
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
blo::Array1D< T > Class Template Reference

1D array. More...

#include <Array1D.h>

Inheritance diagram for blo::Array1D< T >:
blo::Vector< T >

Public Member Functions

 Array1D ()=default
 Default constructor.
 
 Array1D (int len)
 Constructs array of specified size.
 
 Array1D (int len, const T &val)
 Constructs array of specified size and value.
 
 Array1D (const T *pSrc, int len)
 Constructs array that is a copy of specified array.
 
 Array1D (const T *pSrc, int srcStride2, int len)
 Constructs array that is a copy of specified array.
 
 Array1D (const Array1D &rhs)
 Copy constructor.
 
 Array1D (Array1D &&rhs) noexcept
 Move constructor.
 
virtual ~Array1D ()
 Destructor.
 
Array1D & operator= (const Array1D &rhs)
 Copy assignment operator.
 
Array1D & operator= (Array1D &&rhs) noexcept
 Move assignment operator.
 
T & operator[] (int index)
 Index array element.
 
const T & operator[] (int index) const
 Index array element.
 
bool empty () const
 Tests if the array is empty.
 
void resize (int len)
 Resizes array.
 
void clear ()
 Resizes array to zero length.
 
int size () const
 Number of elements in the array.
 
int len () const
 Length of the array.
 
T * ptrData ()
 Retrieves the pointer to the beginning of the array.
 
const T * ptrData () const
 Retrieves the pointer to the beginning of the array.
 
void swap (Array1D &rhs)
 Swaps this array with another one.
 
void set (const T &val)
 Sets array elements to a value.
 

Static Public Member Functions

static int stride2 ()
 Stride in bytes between the elements in the array.
 

Detailed Description

template<typename T>
class blo::Array1D< T >

1D array.

Template Parameters
TData type.

Constructor & Destructor Documentation

◆ Array1D() [1/7]

template<typename T >
blo::Array1D< T >::Array1D ( )
default

Default constructor.

◆ Array1D() [2/7]

template<typename T >
blo::Array1D< T >::Array1D ( int  len)
explicit

Constructs array of specified size.

Parameters
lenArray length.

◆ Array1D() [3/7]

template<typename T >
blo::Array1D< T >::Array1D ( int  len,
const T &  val 
)

Constructs array of specified size and value.

Parameters
lenArray length.
valConstant value to assign to each element in the array.

◆ Array1D() [4/7]

template<typename T >
blo::Array1D< T >::Array1D ( const T *  pSrc,
int  len 
)

Constructs array that is a copy of specified array.

Parameters
pSrcPointer to the source array.
lenArray length.

◆ Array1D() [5/7]

template<typename T >
blo::Array1D< T >::Array1D ( const T *  pSrc,
int  srcStride2,
int  len 
)

Constructs array that is a copy of specified array.

Parameters
pSrcPointer to the source array.
srcStride2Stride in bytes between the elements in the source array.
lenArray length.

◆ Array1D() [6/7]

template<typename T >
blo::Array1D< T >::Array1D ( const Array1D< T > &  rhs)

Copy constructor.

◆ Array1D() [7/7]

template<typename T >
blo::Array1D< T >::Array1D ( Array1D< T > &&  rhs)
noexcept

Move constructor.

◆ ~Array1D()

template<typename T >
virtual blo::Array1D< T >::~Array1D ( )
virtual

Destructor.

Member Function Documentation

◆ clear()

template<typename T >
void blo::Array1D< T >::clear ( )

Resizes array to zero length.

◆ empty()

template<typename T >
bool blo::Array1D< T >::empty ( ) const

Tests if the array is empty.

Returns
true if array is empty, false otherwise.

◆ len()

template<typename T >
int blo::Array1D< T >::len ( ) const

Length of the array.

Returns
Length of the array.

◆ operator=() [1/2]

template<typename T >
Array1D & blo::Array1D< T >::operator= ( Array1D< T > &&  rhs)
noexcept

Move assignment operator.

◆ operator=() [2/2]

template<typename T >
Array1D & blo::Array1D< T >::operator= ( const Array1D< T > &  rhs)

Copy assignment operator.

◆ operator[]() [1/2]

template<typename T >
T & blo::Array1D< T >::operator[] ( int  index)

Index array element.

Parameters
indexIndex of the array.
Returns
The element value.

◆ operator[]() [2/2]

template<typename T >
const T & blo::Array1D< T >::operator[] ( int  index) const

Index array element.

Parameters
indexIndex of the array.
Returns
The element value.

◆ ptrData() [1/2]

template<typename T >
T * blo::Array1D< T >::ptrData ( )

Retrieves the pointer to the beginning of the array.

Returns
Pointer to the beginning of the array.

◆ ptrData() [2/2]

template<typename T >
const T * blo::Array1D< T >::ptrData ( ) const

Retrieves the pointer to the beginning of the array.

Returns
Pointer to the beginning of the array.

◆ resize()

template<typename T >
void blo::Array1D< T >::resize ( int  len)

Resizes array.

Parameters
lenLength to resize array to.

◆ set()

template<typename T >
void blo::Array1D< T >::set ( const T &  val)

Sets array elements to a value.

Parameters
valConstant value to assign to each element in the array.

◆ size()

template<typename T >
int blo::Array1D< T >::size ( ) const

Number of elements in the array.

Returns
Number of elements in the array.

◆ stride2()

template<typename T >
static int blo::Array1D< T >::stride2 ( )
static

Stride in bytes between the elements in the array.

Returns
Stride in bytes between the elements in the array.

◆ swap()

template<typename T >
void blo::Array1D< T >::swap ( Array1D< T > &  rhs)

Swaps this array with another one.


The documentation for this class was generated from the following file: