Eigen-unsupported  3.4.1 (git rev 28ded8800c26864e537852658428ab44c8399e87)
 
Loading...
Searching...
No Matches
CXX11Meta.h
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2013 Christian Seiler <christian@iwakd.de>
5//
6// This Source Code Form is subject to the terms of the Mozilla
7// Public License v. 2.0. If a copy of the MPL was not distributed
8// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
10#ifndef EIGEN_CXX11META_H
11#define EIGEN_CXX11META_H
12
13#include <vector>
14#include "EmulateArray.h"
15
16#include "CXX11Workarounds.h"
17
18namespace Eigen {
19
20namespace internal {
21
27
28template<typename... tt>
29struct type_list { constexpr static int count = sizeof...(tt); };
30
31template<typename t, typename... tt>
32struct type_list<t, tt...> { constexpr static int count = sizeof...(tt) + 1; typedef t first_type; };
33
34template<typename T, T... nn>
35struct numeric_list { constexpr static std::size_t count = sizeof...(nn); };
36
37template<typename T, T n, T... nn>
38struct numeric_list<T, n, nn...> { static const std::size_t count = sizeof...(nn) + 1; const static T first_value = n; };
39
40#ifndef EIGEN_PARSED_BY_DOXYGEN
41/* numeric list constructors
42 *
43 * equivalencies:
44 * constructor result
45 * typename gen_numeric_list<int, 5>::type numeric_list<int, 0,1,2,3,4>
46 * typename gen_numeric_list_reversed<int, 5>::type numeric_list<int, 4,3,2,1,0>
47 * typename gen_numeric_list_swapped_pair<int, 5,1,2>::type numeric_list<int, 0,2,1,3,4>
48 * typename gen_numeric_list_repeated<int, 0, 5>::type numeric_list<int, 0,0,0,0,0>
49 */
50
51template<typename T, std::size_t n, T start = 0, T... ii> struct gen_numeric_list : gen_numeric_list<T, n-1, start, start + n-1, ii...> {};
52template<typename T, T start, T... ii> struct gen_numeric_list<T, 0, start, ii...> { typedef numeric_list<T, ii...> type; };
53
54template<typename T, std::size_t n, T start = 0, T... ii> struct gen_numeric_list_reversed : gen_numeric_list_reversed<T, n-1, start, ii..., start + n-1> {};
55template<typename T, T start, T... ii> struct gen_numeric_list_reversed<T, 0, start, ii...> { typedef numeric_list<T, ii...> type; };
56
57template<typename T, std::size_t n, T a, T b, T start = 0, T... ii> struct gen_numeric_list_swapped_pair : gen_numeric_list_swapped_pair<T, n-1, a, b, start, (start + n-1) == a ? b : ((start + n-1) == b ? a : (start + n-1)), ii...> {};
58template<typename T, T a, T b, T start, T... ii> struct gen_numeric_list_swapped_pair<T, 0, a, b, start, ii...> { typedef numeric_list<T, ii...> type; };
59
60template<typename T, std::size_t n, T V, T... nn> struct gen_numeric_list_repeated : gen_numeric_list_repeated<T, n-1, V, V, nn...> {};
61template<typename T, T V, T... nn> struct gen_numeric_list_repeated<T, 0, V, nn...> { typedef numeric_list<T, nn...> type; };
62
63/* list manipulation: concatenate */
64
65template<class a, class b> struct concat;
66
67template<typename... as, typename... bs> struct concat<type_list<as...>, type_list<bs...>> { typedef type_list<as..., bs...> type; };
68template<typename T, T... as, T... bs> struct concat<numeric_list<T, as...>, numeric_list<T, bs...> > { typedef numeric_list<T, as..., bs...> type; };
69
70template<typename... p> struct mconcat;
71template<typename a> struct mconcat<a> { typedef a type; };
72template<typename a, typename b> struct mconcat<a, b> : concat<a, b> {};
73template<typename a, typename b, typename... cs> struct mconcat<a, b, cs...> : concat<a, typename mconcat<b, cs...>::type> {};
74
75/* list manipulation: extract slices */
76
77template<int n, typename x> struct take;
78template<int n, typename a, typename... as> struct take<n, type_list<a, as...>> : concat<type_list<a>, typename take<n-1, type_list<as...>>::type> {};
79template<int n> struct take<n, type_list<>> { typedef type_list<> type; };
80template<typename a, typename... as> struct take<0, type_list<a, as...>> { typedef type_list<> type; };
81template<> struct take<0, type_list<>> { typedef type_list<> type; };
82
83template<typename T, int n, T a, T... as> struct take<n, numeric_list<T, a, as...>> : concat<numeric_list<T, a>, typename take<n-1, numeric_list<T, as...>>::type> {};
84// XXX The following breaks in gcc-11, and is invalid anyways.
85// template<typename T, int n> struct take<n, numeric_list<T>> { typedef numeric_list<T> type; };
86template<typename T, T a, T... as> struct take<0, numeric_list<T, a, as...>> { typedef numeric_list<T> type; };
87template<typename T> struct take<0, numeric_list<T>> { typedef numeric_list<T> type; };
88
89template<typename T, int n, T... ii> struct h_skip_helper_numeric;
90template<typename T, int n, T i, T... ii> struct h_skip_helper_numeric<T, n, i, ii...> : h_skip_helper_numeric<T, n-1, ii...> {};
91template<typename T, T i, T... ii> struct h_skip_helper_numeric<T, 0, i, ii...> { typedef numeric_list<T, i, ii...> type; };
92template<typename T, int n> struct h_skip_helper_numeric<T, n> { typedef numeric_list<T> type; };
93template<typename T> struct h_skip_helper_numeric<T, 0> { typedef numeric_list<T> type; };
94
95template<int n, typename... tt> struct h_skip_helper_type;
96template<int n, typename t, typename... tt> struct h_skip_helper_type<n, t, tt...> : h_skip_helper_type<n-1, tt...> {};
97template<typename t, typename... tt> struct h_skip_helper_type<0, t, tt...> { typedef type_list<t, tt...> type; };
98template<int n> struct h_skip_helper_type<n> { typedef type_list<> type; };
99template<> struct h_skip_helper_type<0> { typedef type_list<> type; };
100#endif //not EIGEN_PARSED_BY_DOXYGEN
101
102template<int n>
103struct h_skip {
104 template<typename T, T... ii>
105 constexpr static EIGEN_STRONG_INLINE typename h_skip_helper_numeric<T, n, ii...>::type helper(numeric_list<T, ii...>) { return typename h_skip_helper_numeric<T, n, ii...>::type(); }
106 template<typename... tt>
107 constexpr static EIGEN_STRONG_INLINE typename h_skip_helper_type<n, tt...>::type helper(type_list<tt...>) { return typename h_skip_helper_type<n, tt...>::type(); }
108};
109
110template<int n, typename a> struct skip { typedef decltype(h_skip<n>::helper(a())) type; };
111
112template<int start, int count, typename a> struct slice : take<count, typename skip<start, a>::type> {};
113
114/* list manipulation: retrieve single element from list */
115
116template<int n, typename x> struct get;
117
118template<int n, typename a, typename... as> struct get<n, type_list<a, as...>> : get<n-1, type_list<as...>> {};
119template<typename a, typename... as> struct get<0, type_list<a, as...>> { typedef a type; };
120
121template<typename T, int n, T a, T... as> struct get<n, numeric_list<T, a, as...>> : get<n-1, numeric_list<T, as...>> {};
122template<typename T, T a, T... as> struct get<0, numeric_list<T, a, as...>> { constexpr static T value = a; };
123
124template<std::size_t n, typename T, T a, T... as> constexpr T array_get(const numeric_list<T, a, as...>&) {
125 return get<(int)n, numeric_list<T, a, as...>>::value;
126}
127
128/* always get type, regardless of dummy; good for parameter pack expansion */
129
130template<typename T, T dummy, typename t> struct id_numeric { typedef t type; };
131template<typename dummy, typename t> struct id_type { typedef t type; };
132
133/* equality checking, flagged version */
134
135template<typename a, typename b> struct is_same_gf : is_same<a, b> { constexpr static int global_flags = 0; };
136
137/* apply_op to list */
138
139template<
140 bool from_left, // false
141 template<typename, typename> class op,
142 typename additional_param,
143 typename... values
144>
145struct h_apply_op_helper { typedef type_list<typename op<values, additional_param>::type...> type; };
146template<
147 template<typename, typename> class op,
148 typename additional_param,
149 typename... values
150>
151struct h_apply_op_helper<true, op, additional_param, values...> { typedef type_list<typename op<additional_param, values>::type...> type; };
152
153template<
154 bool from_left,
155 template<typename, typename> class op,
156 typename additional_param
157>
158struct h_apply_op
159{
160 template<typename... values>
161 constexpr static typename h_apply_op_helper<from_left, op, additional_param, values...>::type helper(type_list<values...>)
162 { return typename h_apply_op_helper<from_left, op, additional_param, values...>::type(); }
163};
164
165template<
166 template<typename, typename> class op,
167 typename additional_param,
168 typename a
169>
170struct apply_op_from_left { typedef decltype(h_apply_op<true, op, additional_param>::helper(a())) type; };
171
172template<
173 template<typename, typename> class op,
174 typename additional_param,
175 typename a
176>
177struct apply_op_from_right { typedef decltype(h_apply_op<false, op, additional_param>::helper(a())) type; };
178
179/* see if an element is in a list */
180
181template<
182 template<typename, typename> class test,
183 typename check_against,
184 typename h_list,
185 bool last_check_positive = false
186>
187struct contained_in_list;
188
189template<
190 template<typename, typename> class test,
191 typename check_against,
192 typename h_list
193>
194struct contained_in_list<test, check_against, h_list, true>
195{
196 constexpr static bool value = true;
197};
198
199template<
200 template<typename, typename> class test,
201 typename check_against,
202 typename a,
203 typename... as
204>
205struct contained_in_list<test, check_against, type_list<a, as...>, false> : contained_in_list<test, check_against, type_list<as...>, test<check_against, a>::value> {};
206
207template<
208 template<typename, typename> class test,
209 typename check_against
210 EIGEN_TPL_PP_SPEC_HACK_DEFC(typename, empty)
211>
212struct contained_in_list<test, check_against, type_list<EIGEN_TPL_PP_SPEC_HACK_USE(empty)>, false> { constexpr static bool value = false; };
213
214/* see if an element is in a list and check for global flags */
215
216template<
217 template<typename, typename> class test,
218 typename check_against,
219 typename h_list,
220 int default_flags = 0,
221 bool last_check_positive = false,
222 int last_check_flags = default_flags
223>
224struct contained_in_list_gf;
225
226template<
227 template<typename, typename> class test,
228 typename check_against,
229 typename h_list,
230 int default_flags,
231 int last_check_flags
232>
233struct contained_in_list_gf<test, check_against, h_list, default_flags, true, last_check_flags>
234{
235 constexpr static bool value = true;
236 constexpr static int global_flags = last_check_flags;
237};
238
239template<
240 template<typename, typename> class test,
241 typename check_against,
242 typename a,
243 typename... as,
244 int default_flags,
245 int last_check_flags
246>
247struct contained_in_list_gf<test, check_against, type_list<a, as...>, default_flags, false, last_check_flags> : contained_in_list_gf<test, check_against, type_list<as...>, default_flags, test<check_against, a>::value, test<check_against, a>::global_flags> {};
248
249template<
250 template<typename, typename> class test,
251 typename check_against
252 EIGEN_TPL_PP_SPEC_HACK_DEFC(typename, empty),
253 int default_flags,
254 int last_check_flags
255>
256struct contained_in_list_gf<test, check_against, type_list<EIGEN_TPL_PP_SPEC_HACK_USE(empty)>, default_flags, false, last_check_flags> { constexpr static bool value = false; constexpr static int global_flags = default_flags; };
257
258/* generic reductions */
259
260template<
261 typename Reducer,
262 typename... Ts
263> struct reduce;
264
265template<
266 typename Reducer
267> struct reduce<Reducer>
268{
269 EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE int run() { return Reducer::Identity; }
270};
271
272template<
273 typename Reducer,
274 typename A
275> struct reduce<Reducer, A>
276{
277 EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE A run(A a) { return a; }
278};
279
280template<
281 typename Reducer,
282 typename A,
283 typename... Ts
284> struct reduce<Reducer, A, Ts...>
285{
286 EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE auto run(A a, Ts... ts) -> decltype(Reducer::run(a, reduce<Reducer, Ts...>::run(ts...))) {
287 return Reducer::run(a, reduce<Reducer, Ts...>::run(ts...));
288 }
289};
290
291/* generic binary operations */
292
293struct sum_op {
294 template<typename A, typename B> EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a + b) { return a + b; }
295 static constexpr int Identity = 0;
296};
297struct product_op {
298 template<typename A, typename B> EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a * b) { return a * b; }
299 static constexpr int Identity = 1;
300};
301
302struct logical_and_op { template<typename A, typename B> constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a && b) { return a && b; } };
303struct logical_or_op { template<typename A, typename B> constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a || b) { return a || b; } };
304
305struct equal_op { template<typename A, typename B> constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a == b) { return a == b; } };
306struct not_equal_op { template<typename A, typename B> constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a != b) { return a != b; } };
307struct lesser_op { template<typename A, typename B> constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a < b) { return a < b; } };
308struct lesser_equal_op { template<typename A, typename B> constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a <= b) { return a <= b; } };
309struct greater_op { template<typename A, typename B> constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a > b) { return a > b; } };
310struct greater_equal_op { template<typename A, typename B> constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a >= b) { return a >= b; } };
311
312/* generic unary operations */
313
314struct not_op { template<typename A> constexpr static EIGEN_STRONG_INLINE auto run(A a) -> decltype(!a) { return !a; } };
315struct negation_op { template<typename A> constexpr static EIGEN_STRONG_INLINE auto run(A a) -> decltype(-a) { return -a; } };
316struct greater_equal_zero_op { template<typename A> constexpr static EIGEN_STRONG_INLINE auto run(A a) -> decltype(a >= 0) { return a >= 0; } };
317
318
319/* reductions for lists */
320
321// using auto -> return value spec makes ICC 13.0 and 13.1 crash here, so we have to hack it
322// together in front... (13.0 doesn't work with array_prod/array_reduce/... anyway, but 13.1
323// does...
324template<typename... Ts>
325EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE decltype(reduce<product_op, Ts...>::run((*((Ts*)0))...)) arg_prod(Ts... ts)
326{
327 return reduce<product_op, Ts...>::run(ts...);
328}
329
330template<typename... Ts>
331constexpr EIGEN_STRONG_INLINE decltype(reduce<sum_op, Ts...>::run((*((Ts*)0))...)) arg_sum(Ts... ts)
332{
333 return reduce<sum_op, Ts...>::run(ts...);
334}
335
336/* reverse arrays */
337
338template<typename Array, int... n>
339constexpr EIGEN_STRONG_INLINE Array h_array_reverse(Array arr, numeric_list<int, n...>)
340{
341 return {{array_get<sizeof...(n) - n - 1>(arr)...}};
342}
343
344template<typename T, std::size_t N>
345constexpr EIGEN_STRONG_INLINE array<T, N> array_reverse(array<T, N> arr)
346{
347 return h_array_reverse(arr, typename gen_numeric_list<int, N>::type());
348}
349
350
351/* generic array reductions */
352
353// can't reuse standard reduce() interface above because Intel's Compiler
354// *really* doesn't like it, so we just reimplement the stuff
355// (start from N - 1 and work down to 0 because specialization for
356// n == N - 1 also doesn't work in Intel's compiler, so it goes into
357// an infinite loop)
358template<typename Reducer, typename T, std::size_t N, std::size_t n = N - 1>
359struct h_array_reduce {
360 EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE auto run(array<T, N> arr, T identity) -> decltype(Reducer::run(h_array_reduce<Reducer, T, N, n - 1>::run(arr, identity), array_get<n>(arr)))
361 {
362 return Reducer::run(h_array_reduce<Reducer, T, N, n - 1>::run(arr, identity), array_get<n>(arr));
363 }
364};
365
366template<typename Reducer, typename T, std::size_t N>
367struct h_array_reduce<Reducer, T, N, 0>
368{
369 EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE T run(const array<T, N>& arr, T)
370 {
371 return array_get<0>(arr);
372 }
373};
374
375template<typename Reducer, typename T>
376struct h_array_reduce<Reducer, T, 0>
377{
378 EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE T run(const array<T, 0>&, T identity)
379 {
380 return identity;
381 }
382};
383
384template<typename Reducer, typename T, std::size_t N>
385EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE auto array_reduce(const array<T, N>& arr, T identity) -> decltype(h_array_reduce<Reducer, T, N>::run(arr, identity))
386{
387 return h_array_reduce<Reducer, T, N>::run(arr, identity);
388}
389
390/* standard array reductions */
391
392template<typename T, std::size_t N>
393EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE auto array_sum(const array<T, N>& arr) -> decltype(array_reduce<sum_op, T, N>(arr, static_cast<T>(0)))
394{
395 return array_reduce<sum_op, T, N>(arr, static_cast<T>(0));
396}
397
398template<typename T, std::size_t N>
399EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE auto array_prod(const array<T, N>& arr) -> decltype(array_reduce<product_op, T, N>(arr, static_cast<T>(1)))
400{
401 return array_reduce<product_op, T, N>(arr, static_cast<T>(1));
402}
403
404template<typename t>
405EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE t array_prod(const std::vector<t>& a) {
406 eigen_assert(a.size() > 0);
407 t prod = 1;
408 for (size_t i = 0; i < a.size(); ++i) { prod *= a[i]; }
409 return prod;
410}
411
412/* zip an array */
413
414template<typename Op, typename A, typename B, std::size_t N, int... n>
415constexpr EIGEN_STRONG_INLINE array<decltype(Op::run(A(), B())),N> h_array_zip(array<A, N> a, array<B, N> b, numeric_list<int, n...>)
416{
417 return array<decltype(Op::run(A(), B())),N>{{ Op::run(array_get<n>(a), array_get<n>(b))... }};
418}
419
420template<typename Op, typename A, typename B, std::size_t N>
421constexpr EIGEN_STRONG_INLINE array<decltype(Op::run(A(), B())),N> array_zip(array<A, N> a, array<B, N> b)
422{
423 return h_array_zip<Op>(a, b, typename gen_numeric_list<int, N>::type());
424}
425
426/* zip an array and reduce the result */
427
428template<typename Reducer, typename Op, typename A, typename B, std::size_t N, int... n>
429constexpr EIGEN_STRONG_INLINE auto h_array_zip_and_reduce(array<A, N> a, array<B, N> b, numeric_list<int, n...>) -> decltype(reduce<Reducer, typename id_numeric<int,n,decltype(Op::run(A(), B()))>::type...>::run(Op::run(array_get<n>(a), array_get<n>(b))...))
430{
431 return reduce<Reducer, typename id_numeric<int,n,decltype(Op::run(A(), B()))>::type...>::run(Op::run(array_get<n>(a), array_get<n>(b))...);
432}
433
434template<typename Reducer, typename Op, typename A, typename B, std::size_t N>
435constexpr EIGEN_STRONG_INLINE auto array_zip_and_reduce(array<A, N> a, array<B, N> b) -> decltype(h_array_zip_and_reduce<Reducer, Op, A, B, N>(a, b, typename gen_numeric_list<int, N>::type()))
436{
437 return h_array_zip_and_reduce<Reducer, Op, A, B, N>(a, b, typename gen_numeric_list<int, N>::type());
438}
439
440/* apply stuff to an array */
441
442template<typename Op, typename A, std::size_t N, int... n>
443constexpr EIGEN_STRONG_INLINE array<decltype(Op::run(A())),N> h_array_apply(array<A, N> a, numeric_list<int, n...>)
444{
445 return array<decltype(Op::run(A())),N>{{ Op::run(array_get<n>(a))... }};
446}
447
448template<typename Op, typename A, std::size_t N>
449constexpr EIGEN_STRONG_INLINE array<decltype(Op::run(A())),N> array_apply(array<A, N> a)
450{
451 return h_array_apply<Op>(a, typename gen_numeric_list<int, N>::type());
452}
453
454/* apply stuff to an array and reduce */
455
456template<typename Reducer, typename Op, typename A, std::size_t N, int... n>
457constexpr EIGEN_STRONG_INLINE auto h_array_apply_and_reduce(array<A, N> arr, numeric_list<int, n...>) -> decltype(reduce<Reducer, typename id_numeric<int,n,decltype(Op::run(A()))>::type...>::run(Op::run(array_get<n>(arr))...))
458{
459 return reduce<Reducer, typename id_numeric<int,n,decltype(Op::run(A()))>::type...>::run(Op::run(array_get<n>(arr))...);
460}
461
462template<typename Reducer, typename Op, typename A, std::size_t N>
463constexpr EIGEN_STRONG_INLINE auto array_apply_and_reduce(array<A, N> a) -> decltype(h_array_apply_and_reduce<Reducer, Op, A, N>(a, typename gen_numeric_list<int, N>::type()))
464{
465 return h_array_apply_and_reduce<Reducer, Op, A, N>(a, typename gen_numeric_list<int, N>::type());
466}
467
468/* repeat a value n times (and make an array out of it
469 * usage:
470 * array<int, 16> = repeat<16>(42);
471 */
472
473template<int n>
474struct h_repeat
475{
476 template<typename t, int... ii>
477 constexpr static EIGEN_STRONG_INLINE array<t, n> run(t v, numeric_list<int, ii...>)
478 {
479 return {{ typename id_numeric<int, ii, t>::type(v)... }};
480 }
481};
482
483template<int n, typename t>
484constexpr array<t, n> repeat(t v) { return h_repeat<n>::run(v, typename gen_numeric_list<int, n>::type()); }
485
486/* instantiate a class by a C-style array */
487template<class InstType, typename ArrType, std::size_t N, bool Reverse, typename... Ps>
488struct h_instantiate_by_c_array;
489
490template<class InstType, typename ArrType, std::size_t N, typename... Ps>
491struct h_instantiate_by_c_array<InstType, ArrType, N, false, Ps...>
492{
493 static InstType run(ArrType* arr, Ps... args)
494 {
495 return h_instantiate_by_c_array<InstType, ArrType, N - 1, false, Ps..., ArrType>::run(arr + 1, args..., arr[0]);
496 }
497};
498
499template<class InstType, typename ArrType, std::size_t N, typename... Ps>
500struct h_instantiate_by_c_array<InstType, ArrType, N, true, Ps...>
501{
502 static InstType run(ArrType* arr, Ps... args)
503 {
504 return h_instantiate_by_c_array<InstType, ArrType, N - 1, false, ArrType, Ps...>::run(arr + 1, arr[0], args...);
505 }
506};
507
508template<class InstType, typename ArrType, typename... Ps>
509struct h_instantiate_by_c_array<InstType, ArrType, 0, false, Ps...>
510{
511 static InstType run(ArrType* arr, Ps... args)
512 {
513 (void)arr;
514 return InstType(args...);
515 }
516};
517
518template<class InstType, typename ArrType, typename... Ps>
519struct h_instantiate_by_c_array<InstType, ArrType, 0, true, Ps...>
520{
521 static InstType run(ArrType* arr, Ps... args)
522 {
523 (void)arr;
524 return InstType(args...);
525 }
526};
527
528template<class InstType, typename ArrType, std::size_t N, bool Reverse = false>
529InstType instantiate_by_c_array(ArrType* arr)
530{
531 return h_instantiate_by_c_array<InstType, ArrType, N, Reverse>::run(arr);
532}
533
534} // end namespace internal
535
536} // end namespace Eigen
537
538#endif // EIGEN_CXX11META_H
Namespace containing all symbols from the Eigen library.