10 #ifndef EIGEN_EMULATE_ARRAY_H
11 #define EIGEN_EMULATE_ARRAY_H
14 #if defined(EIGEN_GPUCC) || defined(EIGEN_AVOID_STL_ARRAY)
17 template <
typename T,
size_t n>
class array {
22 typedef const T* const_iterator;
25 EIGEN_STRONG_INLINE iterator begin() {
return values; }
27 EIGEN_STRONG_INLINE const_iterator begin()
const {
return values; }
30 EIGEN_STRONG_INLINE iterator
end() {
return values +
n; }
32 EIGEN_STRONG_INLINE const_iterator
end()
const {
return values +
n; }
35 #if !defined(EIGEN_GPUCC)
36 typedef std::reverse_iterator<iterator> reverse_iterator;
37 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
40 EIGEN_STRONG_INLINE reverse_iterator rbegin() {
return reverse_iterator(
end());}
42 EIGEN_STRONG_INLINE const_reverse_iterator rbegin()
const {
return const_reverse_iterator(
end()); }
45 EIGEN_STRONG_INLINE reverse_iterator rend() {
return reverse_iterator(begin()); }
47 EIGEN_STRONG_INLINE const_reverse_iterator rend()
const {
return const_reverse_iterator(begin()); }
56 EIGEN_STRONG_INLINE
T& at(
size_t index) {
eigen_assert(index <
size());
return values[index]; }
58 EIGEN_STRONG_INLINE
const T& at(
size_t index)
const {
eigen_assert(index <
size());
return values[index]; }
61 EIGEN_STRONG_INLINE
T& front() {
return values[0]; }
63 EIGEN_STRONG_INLINE
const T& front()
const {
return values[0]; }
66 EIGEN_STRONG_INLINE
T& back() {
return values[
n-1]; }
68 EIGEN_STRONG_INLINE
const T& back()
const {
return values[
n-1]; }
72 static std::size_t
size() {
return n; }
77 EIGEN_STRONG_INLINE
array() { }
79 EIGEN_STRONG_INLINE
array(
const T&
v) {
84 EIGEN_STRONG_INLINE
array(
const T&
v1,
const T&
v2) {
90 EIGEN_STRONG_INLINE
array(
const T&
v1,
const T&
v2,
const T& v3) {
97 EIGEN_STRONG_INLINE
array(
const T&
v1,
const T&
v2,
const T& v3,
106 EIGEN_STRONG_INLINE
array(
const T&
v1,
const T&
v2,
const T& v3,
const T& v4,
116 EIGEN_STRONG_INLINE
array(
const T&
v1,
const T&
v2,
const T& v3,
const T& v4,
117 const T& v5,
const T& v6) {
127 EIGEN_STRONG_INLINE
array(
const T&
v1,
const T&
v2,
const T& v3,
const T& v4,
128 const T& v5,
const T& v6,
const T& v7) {
139 EIGEN_STRONG_INLINE
array(
140 const T&
v1,
const T&
v2,
const T& v3,
const T& v4,
141 const T& v5,
const T& v6,
const T& v7,
const T& v8) {
154 EIGEN_STRONG_INLINE
array(std::initializer_list<T> l) {
162 template <
typename T>
class array<
T, 0> {
165 EIGEN_STRONG_INLINE
T& operator[] (
size_t) {
170 EIGEN_STRONG_INLINE
const T& operator[] (
size_t)
const {
176 EIGEN_STRONG_INLINE
T& front() {
181 EIGEN_STRONG_INLINE
const T& front()
const {
186 EIGEN_STRONG_INLINE
T& back() {
191 EIGEN_STRONG_INLINE
const T& back()
const {
199 EIGEN_STRONG_INLINE
array() : dummy() { }
212 template<
class T, std::
size_t N>
214 for (std::size_t
i = 0;
i < N; ++
i) {
215 if (lhs[
i] != rhs[
i]) {
224 template<std::
size_t I_,
class T, std::
size_t N>
228 template<std::
size_t I_,
class T, std::
size_t N>
233 template<
class T, std::
size_t N>
struct array_size<
array<
T,N> > {
236 template<
class T, std::
size_t N>
struct array_size<
array<
T,N>& > {
239 template<
class T, std::
size_t N>
struct array_size<const
array<
T,N> > {
242 template<
class T, std::
size_t N>
struct array_size<const
array<
T,N>& > {
256 template <
typename T, std::
size_t N>
using array = std::array<T, N>;
267 #if defined(__GLIBCXX__) && __GLIBCXX__ < 20120322
268 #define STD_GET_ARR_HACK a._M_instance[I_]
269 #elif defined(_LIBCPP_VERSION)
270 #define STD_GET_ARR_HACK a.__elems_[I_]
272 #define STD_GET_ARR_HACK std::template get<I_, T, N>(a)
279 #undef STD_GET_ARR_HACK
Array< int, Dynamic, 1 > v
#define EIGEN_ALWAYS_INLINE
#define eigen_internal_assert(x)
#define EIGEN_UNUSED_VARIABLE(var)
#define EIGEN_DEVICE_FUNC
#define EIGEN_STATIC_ASSERT(X, MSG)
Map< RowVectorXf > v2(M2.data(), M2.size())
M1<< 1, 2, 3, 4, 5, 6, 7, 8, 9;Map< RowVectorXf > v1(M1.data(), M1.size())
static const lastp1_t end
bool operator==(const bfloat16 &a, const bfloat16 &b)
constexpr T & array_get(std::array< T, N > &a)
void smart_copy(const T *start, const T *end, T *target)