Go to the documentation of this file.
7 #ifndef INCLUDE_JET_ARRAY1_H_
8 #define INCLUDE_JET_ARRAY1_H_
34 typedef typename ContainerType::iterator
Iterator;
43 explicit Array(
size_t size,
const T& initVal = T());
57 Array(
const std::initializer_list<T>& lst);
66 void set(
const T& value);
72 void set(
const std::initializer_list<T>& lst);
78 void resize(
size_t size,
const T& initVal = T());
84 const T&
at(
size_t i)
const;
93 const T*
const data()
const;
137 template <
typename Callback>
155 template <
typename Callback>
178 template <
typename Callback>
198 template <
typename Callback>
230 template <
typename T>
235 #include "detail/array1-inl.h"
237 #endif // INCLUDE_JET_ARRAY1_H_
std::vector< T > ContainerType
Definition: array1.h:33
1-D array class.
Definition: array1.h:31
void append(const Array &other)
Appends other array at the end of the array.
const T & at(size_t i) const
Returns the const reference to the i-th element.
Array & operator=(const Array &other)
Copies given array other to this array.
void append(const T &newVal)
Appends single value newVal at the end 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< T > &lst)
Constructs 1-D array with given initializer list lst.
1-D read-only array accessor class.
Definition: array_accessor1.h:184
Array(const Array &other)
Copy constructor.
Iterator end()
Returns the end iterator of the array.
Array(size_t size, const T &initVal=T())
Array & operator=(const std::initializer_list< T > &lst)
Copies given initializer list lst to this array.
ConstArrayAccessor1< T > constAccessor() const
Returns the const array accessor.
Array()
Constructs zero-sized 1-D array.
Array(Array &&other)
Move constructor.
void forEachIndex(Callback func) const
Iterates the array and invoke given func for each index.
T & operator[](size_t i)
Returns the reference to i-th element.
size_t size() const
Returns size of the array.
Definition: advection_solver2.h:18
void forEach(Callback func) const
Iterates the array and invoke given func for each element.
void resize(size_t size, const T &initVal=T())
Resizes the array with size and fill the new element with initVal.
Array & operator=(const T &other)
Sets entire array with given value.
const T & operator[](size_t i) const
Returns the const reference to i-th element.
ConstIterator begin() const
Returns the begin const iterator of the array.
const T *const data() const
Returns the const raw pointer to the array data.
ContainerType::const_iterator ConstIterator
Definition: array1.h:35
Generic N-dimensional array class interface.
Definition: array.h:26
ContainerType::iterator Iterator
Definition: array1.h:34
ArrayAccessor1< T > accessor()
Returns the array accessor.
void swap(Array &other)
Swaps the content of the array with other array.
void clear()
Clears the array and resizes to zero.
void set(const T &value)
Sets entire array with given value.
void set(const Array &other)
Copies given array other to this array.
Array & operator=(Array &&other)
Move assignment.
void parallelForEach(Callback func)
Iterates the array and invoke given func for each element in parallel using multi-threading.
void set(const std::initializer_list< T > &lst)
Copies given initializer list lst to this array.
T & at(size_t i)
Returns the reference to the i-th element.
T * data()
Returns the raw pointer to the array data.
1-D array accessor class.
Definition: array_accessor1.h:27
ConstIterator end() const
Returns the end const iterator of the array.
Iterator begin()
Returns the begin iterator of the array.