23 #ifndef ICL_CORE_ARRAY_2D_H_INCLUDED 24 #define ICL_CORE_ARRAY_2D_H_INCLUDED 37 template <
typename T,
typename TAllocator = std::allocator<T> >
44 typedef typename container_type::size_type
size_type;
46 typedef typename container_type::reference
reference;
48 typedef typename container_type::pointer
pointer;
50 typedef typename container_type::iterator
iterator;
85 void resize(
size_t width,
size_t height)
92 void resize(
size_t width,
size_t height,
const value_type& value)
99 void assign(
size_t width,
size_t height)
106 void assign(
size_t width,
size_t height,
const value_type& value)
118 void set(
const value_type& value)
144 inline size_t index1D(
size_t column,
size_t row)
const {
return row*
m_width + column; }
147 inline void indexTo2D(
size_t i,
size_t& column,
size_t& row)
const const_iterator begin() const
const T & at(size_t column, size_t row) const
2D access.
const T & at(size_t i) const
1D vector-like access.
size_type capacity() const
Array2D(const Array2D &other)
std::vector< T > m_container
container_type::const_pointer const_pointer
allocator_type get_allocator() const
Array2D(size_t width, size_t height, const value_type &value=value_type(), const allocator_type &alloc=allocator_type())
void resize(size_t width, size_t height)
Array2D(const allocator_type &alloc=allocator_type())
void assign(size_t width, size_t height)
container_type::allocator_type allocator_type
T & at(size_t i)
1D vector-like access.
const T & operator()(size_t column, size_t row) const
2D access.
void assign(size_t width, size_t height, const value_type &value)
Array2D & operator=(const Array2D &other)
container_type::reference reference
const T & operator[](size_t i) const
1D vector-like access.
container_type::pointer pointer
T & at(size_t column, size_t row)
2D access.
container_type::difference_type difference_type
size_type max_size() const
container_type::reverse_iterator reverse_iterator
size_t index1D(size_t column, size_t row) const
Calculate the 1D index for 2D array coordinates.
void swap(Array2D &other)
Swap this array with another one.
void resize(size_t width, size_t height, const value_type &value)
void indexTo2D(size_t i, size_t &column, size_t &row) const
Calculate the 2D array coordinates for a given 1D index.
container_type::const_reference const_reference
std::vector< T, TAllocator > container_type
const_iterator end() const
container_type::const_reverse_iterator const_reverse_iterator
container_type::iterator iterator
container_type::value_type value_type
container_type::size_type size_type
container_type::const_iterator const_iterator