10 #define _MRPT_CArray_H 54 template <
typename T, std::
size_t N>
76 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS) 79 #elif defined(_MSC_VER) && (_MSC_VER == 1300) && defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB == 310) 116 static bool empty() {
return false; }
121 inline void resize(
const size_t nElements) {
123 throw std::logic_error(
format(
"Try to change the size of a %u-CArray to %u.",static_cast<unsigned>(N),static_cast<unsigned>(nElements)));
138 template <
typename T2>
147 for (
size_t i=0;i<N;i++)
elems[i]=value;
150 void assign (
const size_t n,
const T& value)
153 if (N!=n)
throw std::out_of_range(
"CArray<>: assign() of incorrect length");
155 for (
size_t i=0;i<N;i++)
elems[i]=value;
159 template<
typename I>
void assign(I b,
const I &e) {
161 if (
std::distance(b,e)!=N)
throw std::out_of_range(
"CArray<>: assign() of incorrect length");
170 throw std::out_of_range(
"CArray<>: index out of range");
177 template <
typename T>
199 #if !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS) 202 #elif defined(_MSC_VER) && (_MSC_VER == 1300) && defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB == 310) 226 throw std::out_of_range(
"CArray<0>: index out of range");
230 throw std::out_of_range(
"<0>: index out of range");
235 static bool empty() {
return true; }
246 const T*
data()
const {
return NULL; }
250 template <
typename T2 >
273 throw std::out_of_range(
"CArray<0>: index out of range");
278 template<
class T, std::
size_t N>
282 template<
class T, std::
size_t N>
286 template<
class T, std::
size_t N>
290 template<
class T, std::
size_t N>
294 template<
class T, std::
size_t N>
298 template<
class T, std::
size_t N>
315 inline operator size_t(
void)
const {
return 2; }
bool operator!=(const CArray< T, N > &x, const CArray< T, N > &y)
const_reference back() const
const_reference operator[](size_type i) const
const_reference at(size_type i) const
std::reverse_iterator< const_iterator > const_reverse_iterator
std::ptrdiff_t difference_type
std::reverse_iterator< iterator > reverse_iterator
std::reverse_iterator< iterator > reverse_iterator
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
Auxiliary class used in CMatrixTemplate:size(), CMatrixTemplate::resize(), CMatrixFixedNumeric::size(...
bool operator!=(const CMatrixTemplateSize &o) const
static void makes_no_sense()
bool operator>(const CArray< T, N > &x, const CArray< T, N > &y)
void swap(CArray< T, N > &y)
bool operator>=(const CArray< T, N > &x, const CArray< T, N > &y)
void swap(CArray< T, 0 > &y)
const T & const_reference
void assign(const size_t n, const T &value)
reference at(size_type i)
const_iterator end() const
static size_type max_size()
const_reference operator[](size_type) const
reverse_iterator rbegin()
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
reference at(size_type i)
const_reference front() const
std::ptrdiff_t difference_type
bool operator==(const CArray< T, N > &x, const CArray< T, N > &y)
const_reference at(size_type i) const
static size_type max_size()
void assign(I b, const I &e)
const_reference back() const
CMatrixTemplateSize mrpt_autotype
const_reference front() const
reference operator[](size_type)
const_iterator end() const
bool operator<(const CArray< T, N > &x, const CArray< T, N > &y)
void assign(const T &value)
const_iterator begin() const
std::reverse_iterator< const_iterator > const_reverse_iterator
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
CArray< T, N > & operator=(const CArray< T2, N > &rhs)
A STL container (as wrapper) for arrays of constant size defined at compile time - Users will most li...
const_reverse_iterator rend() const
bool operator<=(const CArray< T, N > &x, const CArray< T, N > &y)
reference operator[](size_type i)
void resize(const size_t nElements)
This method has no effects in this class, but raises an exception if the expected size does not match...
const_reverse_iterator rend() const
const_reverse_iterator rbegin() const
reverse_iterator rbegin()
const_iterator begin() const
bool operator==(const CMatrixTemplateSize &o) const
static void rangecheck(size_type i)
CMatrixTemplateSize(const size_t *d)
const_reverse_iterator rbegin() const
const T & const_reference
double BASE_IMPEXP distance(const TPoint2D &p1, const TPoint2D &p2)
Gets the distance between two points in a 2D space.