19 #ifndef TORC_ARCHITECTURE_ARRAY_HPP
20 #define TORC_ARCHITECTURE_ARRAY_HPP
22 #include <boost/cstdint.hpp>
23 #include <boost/type_traits.hpp>
24 #include <boost/noncopyable.hpp>
29 namespace architecture {
39 template <
class T>
class Array :
private boost::noncopyable {
69 #define enforceBounds(index) \
70 if(index >= mSize || index < 0) { \
71 char scratch[1 << 10]; \
72 snprintf(scratch, sizeof(scratch), "Index %d not in valid range [0,%d).", index, \
74 throw std::out_of_range(scratch); \
78 #define enforceBounds(index) ;
143 #endif // TORC_ARCHITECTURE_ARRAY_HPP
const T * const_iterator
Constant T iterator type.
#define enforceBounds(index)
Enforce array bounds if so requested.
const T * end(void) const
Returns the constant end iterator.
T * end(void)
Returns the non-constant end iterator.
T * mArray
The internal array.
const T * begin(void) const
Returns the constant begin iterator.
Array< Array< T > > super
Typedef for the base class.
void allocate(uint32_t inSize)
Allocate an array of the specified size.
Encapsulation of a 2D static array.
boost::remove_const< T >::type T_non_const
A type identical to template parameter T, but with any 'const' trait removed.
uint32_t mSize
The logical and actual size of the array.
boost::uint32_t uint32_t
Imported type name.
T * begin(void)
Returns the non-constant begin iterator.
void deallocate(void)
Deallocate the array.
T * iterator
Non-constant T iterator type.
void setSize(uint32_t inSize)
Discards all contents and resizes the array.
T & operator[](uint32_t inIndex)
Non-constant subscript operator.
Encapsulation of a static array.
uint32_t getSize(void) const
Returns the array size.