11 #ifndef CUBBYFLOW_ARRAY_BASE_IMPL_HPP 12 #define CUBBYFLOW_ARRAY_BASE_IMPL_HPP 16 template <
typename T,
size_t N,
typename D>
22 template <
typename T,
size_t N,
typename D>
23 template <
typename... Args>
26 static_assert(
sizeof...(args) == N - 1,
"Invalid number of indices.");
28 return i + m_size[0] * IndexInternal(1, args...);
31 template <
typename T,
size_t N,
typename D>
32 template <
size_t... I>
35 return IndexInternal(idx, std::make_index_sequence<N>{});
38 template <
typename T,
size_t N,
typename D>
44 template <
typename T,
size_t N,
typename D>
50 template <
typename T,
size_t N,
typename D>
56 template <
typename T,
size_t N,
typename D>
63 template <
typename T,
size_t N,
typename D>
70 template <
typename T,
size_t N,
typename D>
77 template <
typename T,
size_t N,
typename D>
83 template <
typename T,
size_t N,
typename D>
86 return Product<size_t, N>(m_size, 1);
89 template <
typename T,
size_t N,
typename D>
95 template <
typename T,
size_t N,
typename D>
101 template <
typename T,
size_t N,
typename D>
104 return m_ptr + Length();
107 template <
typename T,
size_t N,
typename D>
110 return m_ptr + Length();
113 template <
typename T,
size_t N,
typename D>
119 template <
typename T,
size_t N,
typename D>
125 template <
typename T,
size_t N,
typename D>
131 template <
typename T,
size_t N,
typename D>
137 template <
typename T,
size_t N,
typename D>
143 template <
typename T,
size_t N,
typename D>
149 template <
typename T,
size_t N,
typename D>
150 template <
typename... Args>
153 return data()[Index(i, args...)];
156 template <
typename T,
size_t N,
typename D>
157 template <
typename... Args>
160 return m_ptr[Index(i, args...)];
163 template <
typename T,
size_t N,
typename D>
166 return data()[Index(idx)];
169 template <
typename T,
size_t N,
typename D>
172 return data()[Index(idx)];
175 template <
typename T,
size_t N,
typename D>
181 template <
typename T,
size_t N,
typename D>
187 template <
typename T,
size_t N,
typename D>
188 template <
typename... Args>
191 return At(i, args...);
194 template <
typename T,
size_t N,
typename D>
195 template <
typename... Args>
198 return At(i, args...);
201 template <
typename T,
size_t N,
typename D>
207 template <
typename T,
size_t N,
typename D>
213 template <
typename T,
size_t N,
typename D>
219 template <
typename T,
size_t N,
typename D>
225 template <
typename T,
size_t N,
typename D>
228 *
this = std::move(other);
231 template <
typename T,
size_t N,
typename D>
234 SetPtrAndSize(other.
data(), other.
Size());
239 template <
typename T,
size_t N,
typename D>
242 SetPtrAndSize(other.data(), other.Size());
248 template <
typename T,
size_t N,
typename D>
249 template <
typename... Args>
255 template <
typename T,
size_t N,
typename D>
262 template <
typename T,
size_t N,
typename D>
268 template <
typename T,
size_t N,
typename D>
271 std::swap(m_ptr, other.
m_ptr);
272 std::swap(m_size, other.
m_size);
275 template <
typename T,
size_t N,
typename D>
276 template <
typename... Args>
279 return i + m_size[d] * IndexInternal(d + 1, args...);
282 template <
typename T,
size_t N,
typename D>
288 template <
typename T,
size_t N,
typename D>
289 template <
size_t... I>
291 std::index_sequence<I...>)
const 293 return Index(idx[I]...);
Reference operator[](size_t i)
Definition: ArrayBase-Impl.hpp:176
Definition: ArrayBase.hpp:19
Iterator end()
Definition: ArrayBase-Impl.hpp:102
Pointer m_ptr
Definition: ArrayBase.hpp:124
Vector< size_t, N > m_size
Definition: ArrayBase.hpp:125
Definition: Matrix.hpp:27
Definition: pybind11Utils.hpp:20
Iterator begin()
Definition: ArrayBase-Impl.hpp:90
size_t Length() const
Definition: ArrayBase-Impl.hpp:84
Reference operator()(size_t i, Args... args)
Iterator rbegin()
Definition: ArrayBase-Impl.hpp:114
Pointer data()
Definition: ArrayBase-Impl.hpp:39
ArrayBase()
Definition: ArrayBase-Impl.hpp:214
bool IsEmpty() const
Definition: ArrayBase-Impl.hpp:78
const T * ConstIterator
Definition: ArrayBase.hpp:29
const Vector< size_t, N > & Size() const
Definition: ArrayBase-Impl.hpp:51
size_t Index(size_t i) const
Definition: ArrayBase-Impl.hpp:17
Iterator rend()
Definition: ArrayBase-Impl.hpp:126
Reference At(size_t i)
Definition: ArrayBase-Impl.hpp:138
T * Iterator
Definition: ArrayBase.hpp:28
void SetPtrAndSize(Pointer ptr, size_t ni, Args... args)
Definition: ArrayBase-Impl.hpp:250