GJK_nD
 All Classes Files Functions Typedefs Friends Pages
Public Member Functions | List of all members
Utils::Array2D< T > Class Template Reference

A minimalist but handy templated class to manipulate 2D arrays of values. More...

#include <Array2D.hpp>

Public Member Functions

 Array2D ()
 
 Array2D (size_t width, size_t height)
 
 Array2D (const Array2D< T > &srcArray)
 
 ~Array2D ()
 
Array2Doperator= (const Array2D< T > &srcArray)
 
const T & operator() (size_t x, size_t y) const
 
T & operator() (size_t x, size_t y)
 
size_t width () const
 
size_t height () const
 

Detailed Description

template<typename T>
class Utils::Array2D< T >

A minimalist but handy templated class to manipulate 2D arrays of values.

Array2D allows us to create a m x n array and acces its elements through the () operator.

Array2D<int> tab(3,7);
std::cout << "Value at index (1,4): " << tab(1,4) << std::endl;
tab(0,5) = 42;

Constructor & Destructor Documentation

template<typename T>
Utils::Array2D< T >::Array2D ( )
inline

Construct an empty array.

template<typename T>
Utils::Array2D< T >::Array2D ( size_t  width,
size_t  height 
)
inline

Construct a width x height array.

template<typename T>
Utils::Array2D< T >::Array2D ( const Array2D< T > &  srcArray)
inline

Create a copy of srcArray.

template<typename T>
Utils::Array2D< T >::~Array2D ( )
inline

Destroy the array

Member Function Documentation

template<typename T>
size_t Utils::Array2D< T >::height ( ) const
inline

Return the height of the array.

template<typename T>
const T& Utils::Array2D< T >::operator() ( size_t  x,
size_t  y 
) const
inline

Return the contents of the array at position (x, y)

template<typename T>
T& Utils::Array2D< T >::operator() ( size_t  x,
size_t  y 
)
inline

Return an l-value reference to the element at position (x, y). This element can thus be modified.

template<typename T>
Array2D& Utils::Array2D< T >::operator= ( const Array2D< T > &  srcArray)
inline

Copy the content of srcArray into this array

template<typename T>
size_t Utils::Array2D< T >::width ( ) const
inline

Return the width of the array.


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