Go to the documentation of this file.
7 #ifndef INCLUDE_JET_ARRAY2_H_
8 #define INCLUDE_JET_ARRAY2_H_
45 typedef typename ContainerType::iterator
Iterator;
54 explicit Array(
const Size2& size,
const T& initVal = T());
61 Array(
size_t width,
size_t height,
const T& initVal = T());
81 Array(
const std::initializer_list<std::initializer_list<T>>& lst);
90 void set(
const T& value);
113 void set(
const std::initializer_list<std::initializer_list<T>>& lst);
123 void resize(
size_t width,
size_t height,
const T& initVal = T());
141 const T&
at(
size_t i)
const;
150 T&
at(
size_t i,
size_t j);
153 const T&
at(
size_t i,
size_t j)
const;
217 template <
typename Callback>
246 template <
typename Callback>
268 template <
typename Callback>
288 template <
typename Callback>
353 const std::initializer_list<std::initializer_list<T>>& lst);
363 std::vector<T> _data;
367 template <
typename T>
372 #include "detail/array2-inl.h"
374 #endif // INCLUDE_JET_ARRAY2_H_
2-D point class.
Definition: point2.h:23
void forEach(Callback func) const
Iterates the array and invoke given func for each index.
void resize(size_t width, size_t height, const T &initVal=T())
T & operator()(const Point2UI &pt)
Returns the reference to the element at (pt.x, pt.y).
ContainerType::const_iterator ConstIterator
Definition: array2.h:46
const T *const data() const
Returns the const raw pointer to the array data.
Array(const Size2 &size, const T &initVal=T())
ConstArrayAccessor2< T > constAccessor() const
Returns the const array accessor.
const T & operator[](size_t i) const
Returns the const reference to the i-th element.
T & at(size_t i)
Returns the reference to the i-th element.
Array & operator=(Array &&other)
Move assignment.
void clear()
Clears the array and resizes to zero.
void resize(const Size2 &size, const T &initVal=T())
Resizes the array with size and fill the new element with initVal.
const T & operator()(const Point2UI &pt) const
Returns the const reference to the element at (pt.x, pt.y).
T & at(const Point2UI &pt)
Returns the reference to the element at (pt.x, pt.y).
size_t height() const
Returns the height of the array.
void set(const std::initializer_list< std::initializer_list< T >> &lst)
Iterator end()
Returns the end iterator of the array.
2-D array class.
Definition: array2.h:42
ArrayAccessor2< T > accessor()
Returns the array accessor.
T & at(size_t i, size_t j)
Returns the reference to the element at (i, j).
Definition: advection_solver2.h:18
void set(const T &value)
Sets entire array with given value.
Size2 size() const
Returns the size of the array.
2-D read-only array accessor class.
Definition: array_accessor2.h:261
ConstIterator end() const
Returns the end const iterator of the array.
std::vector< T > ContainerType
Definition: array2.h:44
const T & at(size_t i) const
Returns the const reference to the i-th element.
Iterator begin()
Returns the begin iterator of the array.
ConstIterator begin() const
Returns the begin const iterator of the array.
void parallelForEachIndex(Callback func) const
Iterates the array and invoke given func for each index in parallel using multi-threading.
Array(const std::initializer_list< std::initializer_list< T >> &lst)
Constructs 2-D array with given initializer list lst.
2-D size class.
Definition: size2.h:19
2-D array accessor class.
Definition: array_accessor2.h:31
Array & operator=(const Array &other)
Copies given array other to this array.
Array & operator=(const std::initializer_list< std::initializer_list< T >> &lst)
Generic N-dimensional array class interface.
Definition: array.h:26
const T & at(const Point2UI &pt) const
Returns the const reference to the element at (pt.x, pt.y).
void set(const Array &other)
Copies given array other to this array.
void swap(Array &other)
Swaps the content of the array with other array.
T & operator()(size_t i, size_t j)
Returns the reference to the element at (i, j).
void forEachIndex(Callback func) const
Iterates the array and invoke given func for each index.
void parallelForEach(Callback func)
Iterates the array and invoke given func for each index in parallel.
T & operator[](size_t i)
Returns the reference to the i-th element.
ContainerType::iterator Iterator
Definition: array2.h:45
size_t width() const
Returns the width of the array.
const T & operator()(size_t i, size_t j) const
Returns the const reference to the element at (i, j).
Array(Array &&other)
Move constructor.
T * data()
Returns the raw pointer to the array data.
const T & at(size_t i, size_t j) const
Returns the const reference to the element at (i, j).
Array & operator=(const T &other)
Sets entire array with given value.
Array()
Constructs zero-sized 2-D array.
Array(size_t width, size_t height, const T &initVal=T())
Array(const Array &other)
Copy constructor.