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 #include "main.h"
11 
12 #include <array>
13 #include <Eigen/CXX11/src/util/CXX11Meta.h>
14 
15 using Eigen::internal::is_same;
16 using Eigen::internal::type_list;
17 using Eigen::internal::numeric_list;
18 using Eigen::internal::gen_numeric_list;
19 using Eigen::internal::gen_numeric_list_reversed;
20 using Eigen::internal::gen_numeric_list_swapped_pair;
21 using Eigen::internal::gen_numeric_list_repeated;
22 using Eigen::internal::concat;
23 using Eigen::internal::mconcat;
24 using Eigen::internal::take;
25 using Eigen::internal::skip;
26 using Eigen::internal::slice;
27 using Eigen::internal::get;
28 using Eigen::internal::id_numeric;
29 using Eigen::internal::id_type;
30 using Eigen::internal::is_same_gf;
31 using Eigen::internal::apply_op_from_left;
32 using Eigen::internal::apply_op_from_right;
33 using Eigen::internal::contained_in_list;
34 using Eigen::internal::contained_in_list_gf;
35 using Eigen::internal::arg_prod;
36 using Eigen::internal::arg_sum;
37 using Eigen::internal::sum_op;
38 using Eigen::internal::product_op;
39 using Eigen::internal::array_reverse;
40 using Eigen::internal::array_sum;
41 using Eigen::internal::array_prod;
42 using Eigen::internal::array_reduce;
43 using Eigen::internal::array_zip;
44 using Eigen::internal::array_zip_and_reduce;
45 using Eigen::internal::array_apply;
46 using Eigen::internal::array_apply_and_reduce;
47 using Eigen::internal::repeat;
48 using Eigen::internal::instantiate_by_c_array;
49 
50 struct dummy_a {};
51 struct dummy_b {};
52 struct dummy_c {};
53 struct dummy_d {};
54 struct dummy_e {};
55 
56 // dummy operation for testing apply
57 template<typename A, typename B> struct dummy_op;
58 template<> struct dummy_op<dummy_a, dummy_b> { typedef dummy_c type; };
59 template<> struct dummy_op<dummy_b, dummy_a> { typedef dummy_d type; };
60 template<> struct dummy_op<dummy_b, dummy_c> { typedef dummy_a type; };
61 template<> struct dummy_op<dummy_c, dummy_b> { typedef dummy_d type; };
62 template<> struct dummy_op<dummy_c, dummy_a> { typedef dummy_b type; };
63 template<> struct dummy_op<dummy_a, dummy_c> { typedef dummy_d type; };
64 template<> struct dummy_op<dummy_a, dummy_a> { typedef dummy_e type; };
65 template<> struct dummy_op<dummy_b, dummy_b> { typedef dummy_e type; };
66 template<> struct dummy_op<dummy_c, dummy_c> { typedef dummy_e type; };
67 
68 template<typename A, typename B> struct dummy_test { constexpr static bool value = false; constexpr static int global_flags = 0; };
69 template<> struct dummy_test<dummy_a, dummy_a>     { constexpr static bool value = true;  constexpr static int global_flags = 1; };
70 template<> struct dummy_test<dummy_b, dummy_b>     { constexpr static bool value = true;  constexpr static int global_flags = 2; };
71 template<> struct dummy_test<dummy_c, dummy_c>     { constexpr static bool value = true;  constexpr static int global_flags = 4; };
72 
runtimes2_op73 struct times2_op { template<typename A> static A run(A v) { return v * 2; } };
74 
75 struct dummy_inst
76 {
77   int c;
78 
dummy_instdummy_inst79   dummy_inst() : c(0) {}
dummy_instdummy_inst80   explicit dummy_inst(int) : c(1) {}
dummy_instdummy_inst81   dummy_inst(int, int) : c(2) {}
dummy_instdummy_inst82   dummy_inst(int, int, int) : c(3) {}
dummy_instdummy_inst83   dummy_inst(int, int, int, int) : c(4) {}
dummy_instdummy_inst84   dummy_inst(int, int, int, int, int) : c(5) {}
85 };
86 
test_gen_numeric_list()87 static void test_gen_numeric_list()
88 {
89   VERIFY((is_same<typename gen_numeric_list<int, 0>::type, numeric_list<int>>::value));
90   VERIFY((is_same<typename gen_numeric_list<int, 1>::type, numeric_list<int, 0>>::value));
91   VERIFY((is_same<typename gen_numeric_list<int, 2>::type, numeric_list<int, 0, 1>>::value));
92   VERIFY((is_same<typename gen_numeric_list<int, 5>::type, numeric_list<int, 0, 1, 2, 3, 4>>::value));
93   VERIFY((is_same<typename gen_numeric_list<int, 10>::type, numeric_list<int, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9>>::value));
94 
95   VERIFY((is_same<typename gen_numeric_list<int, 0, 42>::type, numeric_list<int>>::value));
96   VERIFY((is_same<typename gen_numeric_list<int, 1, 42>::type, numeric_list<int, 42>>::value));
97   VERIFY((is_same<typename gen_numeric_list<int, 2, 42>::type, numeric_list<int, 42, 43>>::value));
98   VERIFY((is_same<typename gen_numeric_list<int, 5, 42>::type, numeric_list<int, 42, 43, 44, 45, 46>>::value));
99   VERIFY((is_same<typename gen_numeric_list<int, 10, 42>::type, numeric_list<int, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51>>::value));
100 
101   VERIFY((is_same<typename gen_numeric_list_reversed<int, 0>::type, numeric_list<int>>::value));
102   VERIFY((is_same<typename gen_numeric_list_reversed<int, 1>::type, numeric_list<int, 0>>::value));
103   VERIFY((is_same<typename gen_numeric_list_reversed<int, 2>::type, numeric_list<int, 1, 0>>::value));
104   VERIFY((is_same<typename gen_numeric_list_reversed<int, 5>::type, numeric_list<int, 4, 3, 2, 1, 0>>::value));
105   VERIFY((is_same<typename gen_numeric_list_reversed<int, 10>::type, numeric_list<int, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0>>::value));
106 
107   VERIFY((is_same<typename gen_numeric_list_reversed<int, 0, 42>::type, numeric_list<int>>::value));
108   VERIFY((is_same<typename gen_numeric_list_reversed<int, 1, 42>::type, numeric_list<int, 42>>::value));
109   VERIFY((is_same<typename gen_numeric_list_reversed<int, 2, 42>::type, numeric_list<int, 43, 42>>::value));
110   VERIFY((is_same<typename gen_numeric_list_reversed<int, 5, 42>::type, numeric_list<int, 46, 45, 44, 43, 42>>::value));
111   VERIFY((is_same<typename gen_numeric_list_reversed<int, 10, 42>::type, numeric_list<int, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42>>::value));
112 
113   VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 0, 2, 3>::type, numeric_list<int>>::value));
114   VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 1, 2, 3>::type, numeric_list<int, 0>>::value));
115   VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 2, 2, 3>::type, numeric_list<int, 0, 1>>::value));
116   VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 5, 2, 3>::type, numeric_list<int, 0, 1, 3, 2, 4>>::value));
117   VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 10, 2, 3>::type, numeric_list<int, 0, 1, 3, 2, 4, 5, 6, 7, 8, 9>>::value));
118 
119   VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 0, 44, 45, 42>::type, numeric_list<int>>::value));
120   VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 1, 44, 45, 42>::type, numeric_list<int, 42>>::value));
121   VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 2, 44, 45, 42>::type, numeric_list<int, 42, 43>>::value));
122   VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 5, 44, 45, 42>::type, numeric_list<int, 42, 43, 45, 44, 46>>::value));
123   VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 10, 44, 45, 42>::type, numeric_list<int, 42, 43, 45, 44, 46, 47, 48, 49, 50, 51>>::value));
124 
125   VERIFY((is_same<typename gen_numeric_list_repeated<int, 0, 0>::type, numeric_list<int>>::value));
126   VERIFY((is_same<typename gen_numeric_list_repeated<int, 1, 0>::type, numeric_list<int, 0>>::value));
127   VERIFY((is_same<typename gen_numeric_list_repeated<int, 2, 0>::type, numeric_list<int, 0, 0>>::value));
128   VERIFY((is_same<typename gen_numeric_list_repeated<int, 5, 0>::type, numeric_list<int, 0, 0, 0, 0, 0>>::value));
129   VERIFY((is_same<typename gen_numeric_list_repeated<int, 10, 0>::type, numeric_list<int, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>>::value));
130 }
131 
test_concat()132 static void test_concat()
133 {
134   VERIFY((is_same<typename concat<type_list<dummy_a, dummy_a>, type_list<>>::type, type_list<dummy_a, dummy_a>>::value));
135   VERIFY((is_same<typename concat<type_list<>, type_list<dummy_a, dummy_a>>::type, type_list<dummy_a, dummy_a>>::value));
136   VERIFY((is_same<typename concat<type_list<dummy_a, dummy_a>, type_list<dummy_a, dummy_a>>::type, type_list<dummy_a, dummy_a, dummy_a, dummy_a>>::value));
137   VERIFY((is_same<typename concat<type_list<dummy_a, dummy_a>, type_list<dummy_b, dummy_c>>::type, type_list<dummy_a, dummy_a, dummy_b, dummy_c>>::value));
138   VERIFY((is_same<typename concat<type_list<dummy_a>, type_list<dummy_b, dummy_c>>::type, type_list<dummy_a, dummy_b, dummy_c>>::value));
139 
140   VERIFY((is_same<typename concat<numeric_list<int, 0, 0>, numeric_list<int>>::type, numeric_list<int, 0, 0>>::value));
141   VERIFY((is_same<typename concat<numeric_list<int>, numeric_list<int, 0, 0>>::type, numeric_list<int, 0, 0>>::value));
142   VERIFY((is_same<typename concat<numeric_list<int, 0, 0>, numeric_list<int, 0, 0>>::type, numeric_list<int, 0, 0, 0, 0>>::value));
143   VERIFY((is_same<typename concat<numeric_list<int, 0, 0>, numeric_list<int, 1, 2>>::type, numeric_list<int, 0, 0, 1, 2>>::value));
144   VERIFY((is_same<typename concat<numeric_list<int, 0>, numeric_list<int, 1, 2>>::type, numeric_list<int, 0, 1, 2>>::value));
145 
146   VERIFY((is_same<typename mconcat<type_list<dummy_a>>::type, type_list<dummy_a>>::value));
147   VERIFY((is_same<typename mconcat<type_list<dummy_a>, type_list<dummy_b>>::type, type_list<dummy_a, dummy_b>>::value));
148   VERIFY((is_same<typename mconcat<type_list<dummy_a>, type_list<dummy_b>, type_list<dummy_c>>::type, type_list<dummy_a, dummy_b, dummy_c>>::value));
149   VERIFY((is_same<typename mconcat<type_list<dummy_a>, type_list<dummy_b, dummy_c>>::type, type_list<dummy_a, dummy_b, dummy_c>>::value));
150   VERIFY((is_same<typename mconcat<type_list<dummy_a, dummy_b>, type_list<dummy_c>>::type, type_list<dummy_a, dummy_b, dummy_c>>::value));
151 
152   VERIFY((is_same<typename mconcat<numeric_list<int, 0>>::type, numeric_list<int, 0>>::value));
153   VERIFY((is_same<typename mconcat<numeric_list<int, 0>, numeric_list<int, 1>>::type, numeric_list<int, 0, 1>>::value));
154   VERIFY((is_same<typename mconcat<numeric_list<int, 0>, numeric_list<int, 1>, numeric_list<int, 2>>::type, numeric_list<int, 0, 1, 2>>::value));
155   VERIFY((is_same<typename mconcat<numeric_list<int, 0>, numeric_list<int, 1, 2>>::type, numeric_list<int, 0, 1, 2>>::value));
156   VERIFY((is_same<typename mconcat<numeric_list<int, 0, 1>, numeric_list<int, 2>>::type, numeric_list<int, 0, 1, 2>>::value));
157 }
158 
test_slice()159 static void test_slice()
160 {
161   typedef type_list<dummy_a, dummy_a, dummy_b, dummy_b, dummy_c, dummy_c> tl;
162   typedef numeric_list<int, 0, 1, 2, 3, 4, 5> il;
163 
164   VERIFY((is_same<typename take<0, tl>::type, type_list<>>::value));
165   VERIFY((is_same<typename take<1, tl>::type, type_list<dummy_a>>::value));
166   VERIFY((is_same<typename take<2, tl>::type, type_list<dummy_a, dummy_a>>::value));
167   VERIFY((is_same<typename take<3, tl>::type, type_list<dummy_a, dummy_a, dummy_b>>::value));
168   VERIFY((is_same<typename take<4, tl>::type, type_list<dummy_a, dummy_a, dummy_b, dummy_b>>::value));
169   VERIFY((is_same<typename take<5, tl>::type, type_list<dummy_a, dummy_a, dummy_b, dummy_b, dummy_c>>::value));
170   VERIFY((is_same<typename take<6, tl>::type, type_list<dummy_a, dummy_a, dummy_b, dummy_b, dummy_c, dummy_c>>::value));
171 
172   VERIFY((is_same<typename take<0, il>::type, numeric_list<int>>::value));
173   VERIFY((is_same<typename take<1, il>::type, numeric_list<int, 0>>::value));
174   VERIFY((is_same<typename take<2, il>::type, numeric_list<int, 0, 1>>::value));
175   VERIFY((is_same<typename take<3, il>::type, numeric_list<int, 0, 1, 2>>::value));
176   VERIFY((is_same<typename take<4, il>::type, numeric_list<int, 0, 1, 2, 3>>::value));
177   VERIFY((is_same<typename take<5, il>::type, numeric_list<int, 0, 1, 2, 3, 4>>::value));
178   VERIFY((is_same<typename take<6, il>::type, numeric_list<int, 0, 1, 2, 3, 4, 5>>::value));
179 
180   VERIFY((is_same<typename skip<0, tl>::type, type_list<dummy_a, dummy_a, dummy_b, dummy_b, dummy_c, dummy_c>>::value));
181   VERIFY((is_same<typename skip<1, tl>::type, type_list<dummy_a, dummy_b, dummy_b, dummy_c, dummy_c>>::value));
182   VERIFY((is_same<typename skip<2, tl>::type, type_list<dummy_b, dummy_b, dummy_c, dummy_c>>::value));
183   VERIFY((is_same<typename skip<3, tl>::type, type_list<dummy_b, dummy_c, dummy_c>>::value));
184   VERIFY((is_same<typename skip<4, tl>::type, type_list<dummy_c, dummy_c>>::value));
185   VERIFY((is_same<typename skip<5, tl>::type, type_list<dummy_c>>::value));
186   VERIFY((is_same<typename skip<6, tl>::type, type_list<>>::value));
187 
188   VERIFY((is_same<typename skip<0, il>::type, numeric_list<int, 0, 1, 2, 3, 4, 5>>::value));
189   VERIFY((is_same<typename skip<1, il>::type, numeric_list<int, 1, 2, 3, 4, 5>>::value));
190   VERIFY((is_same<typename skip<2, il>::type, numeric_list<int, 2, 3, 4, 5>>::value));
191   VERIFY((is_same<typename skip<3, il>::type, numeric_list<int, 3, 4, 5>>::value));
192   VERIFY((is_same<typename skip<4, il>::type, numeric_list<int, 4, 5>>::value));
193   VERIFY((is_same<typename skip<5, il>::type, numeric_list<int, 5>>::value));
194   VERIFY((is_same<typename skip<6, il>::type, numeric_list<int>>::value));
195 
196   VERIFY((is_same<typename slice<0, 3, tl>::type, typename take<3, tl>::type>::value));
197   VERIFY((is_same<typename slice<0, 3, il>::type, typename take<3, il>::type>::value));
198   VERIFY((is_same<typename slice<1, 3, tl>::type, type_list<dummy_a, dummy_b, dummy_b>>::value));
199   VERIFY((is_same<typename slice<1, 3, il>::type, numeric_list<int, 1, 2, 3>>::value));
200 }
201 
test_get()202 static void test_get()
203 {
204   typedef type_list<dummy_a, dummy_a, dummy_b, dummy_b, dummy_c, dummy_c> tl;
205   typedef numeric_list<int, 4, 8, 15, 16, 23, 42> il;
206 
207   VERIFY((is_same<typename get<0, tl>::type, dummy_a>::value));
208   VERIFY((is_same<typename get<1, tl>::type, dummy_a>::value));
209   VERIFY((is_same<typename get<2, tl>::type, dummy_b>::value));
210   VERIFY((is_same<typename get<3, tl>::type, dummy_b>::value));
211   VERIFY((is_same<typename get<4, tl>::type, dummy_c>::value));
212   VERIFY((is_same<typename get<5, tl>::type, dummy_c>::value));
213 
214   VERIFY_IS_EQUAL(((int)get<0, il>::value), 4);
215   VERIFY_IS_EQUAL(((int)get<1, il>::value), 8);
216   VERIFY_IS_EQUAL(((int)get<2, il>::value), 15);
217   VERIFY_IS_EQUAL(((int)get<3, il>::value), 16);
218   VERIFY_IS_EQUAL(((int)get<4, il>::value), 23);
219   VERIFY_IS_EQUAL(((int)get<5, il>::value), 42);
220 }
221 
test_id_helper(dummy_a a,dummy_a b,dummy_a c)222 static void test_id_helper(dummy_a a, dummy_a b, dummy_a c)
223 {
224   (void)a;
225   (void)b;
226   (void)c;
227 }
228 
229 template<int... ii>
test_id_numeric()230 static void test_id_numeric()
231 {
232   test_id_helper(typename id_numeric<int, ii, dummy_a>::type()...);
233 }
234 
235 template<typename... tt>
test_id_type()236 static void test_id_type()
237 {
238   test_id_helper(typename id_type<tt, dummy_a>::type()...);
239 }
240 
test_id()241 static void test_id()
242 {
243   // don't call VERIFY here, just assume it works if it compiles
244   // (otherwise it will complain that it can't find the function)
245   test_id_numeric<1, 4, 6>();
246   test_id_type<dummy_a, dummy_b, dummy_c>();
247 }
248 
test_is_same_gf()249 static void test_is_same_gf()
250 {
251   VERIFY((!is_same_gf<dummy_a, dummy_b>::value));
252   VERIFY((!!is_same_gf<dummy_a, dummy_a>::value));
253   VERIFY_IS_EQUAL((!!is_same_gf<dummy_a, dummy_b>::global_flags), false);
254   VERIFY_IS_EQUAL((!!is_same_gf<dummy_a, dummy_a>::global_flags), false);
255 }
256 
test_apply_op()257 static void test_apply_op()
258 {
259   typedef type_list<dummy_a, dummy_b, dummy_c> tl;
260   VERIFY((!!is_same<typename apply_op_from_left<dummy_op, dummy_a, tl>::type, type_list<dummy_e, dummy_c, dummy_d>>::value));
261   VERIFY((!!is_same<typename apply_op_from_right<dummy_op, dummy_a, tl>::type, type_list<dummy_e, dummy_d, dummy_b>>::value));
262 }
263 
test_contained_in_list()264 static void test_contained_in_list()
265 {
266   typedef type_list<dummy_a, dummy_b, dummy_c> tl;
267 
268   VERIFY((!!contained_in_list<is_same, dummy_a, tl>::value));
269   VERIFY((!!contained_in_list<is_same, dummy_b, tl>::value));
270   VERIFY((!!contained_in_list<is_same, dummy_c, tl>::value));
271   VERIFY((!contained_in_list<is_same, dummy_d, tl>::value));
272   VERIFY((!contained_in_list<is_same, dummy_e, tl>::value));
273 
274   VERIFY((!!contained_in_list_gf<dummy_test, dummy_a, tl>::value));
275   VERIFY((!!contained_in_list_gf<dummy_test, dummy_b, tl>::value));
276   VERIFY((!!contained_in_list_gf<dummy_test, dummy_c, tl>::value));
277   VERIFY((!contained_in_list_gf<dummy_test, dummy_d, tl>::value));
278   VERIFY((!contained_in_list_gf<dummy_test, dummy_e, tl>::value));
279 
280   VERIFY_IS_EQUAL(((int)contained_in_list_gf<dummy_test, dummy_a, tl>::global_flags), 1);
281   VERIFY_IS_EQUAL(((int)contained_in_list_gf<dummy_test, dummy_b, tl>::global_flags), 2);
282   VERIFY_IS_EQUAL(((int)contained_in_list_gf<dummy_test, dummy_c, tl>::global_flags), 4);
283   VERIFY_IS_EQUAL(((int)contained_in_list_gf<dummy_test, dummy_d, tl>::global_flags), 0);
284   VERIFY_IS_EQUAL(((int)contained_in_list_gf<dummy_test, dummy_e, tl>::global_flags), 0);
285 }
286 
test_arg_reductions()287 static void test_arg_reductions()
288 {
289   VERIFY_IS_EQUAL(arg_sum(1,2,3,4), 10);
290   VERIFY_IS_EQUAL(arg_prod(1,2,3,4), 24);
291   VERIFY_IS_APPROX(arg_sum(0.5, 2, 5), 7.5);
292   VERIFY_IS_APPROX(arg_prod(0.5, 2, 5), 5.0);
293 }
294 
test_array_reverse_and_reduce()295 static void test_array_reverse_and_reduce()
296 {
297   array<int, 6> a{{4, 8, 15, 16, 23, 42}};
298   array<int, 6> b{{42, 23, 16, 15, 8, 4}};
299 
300   // there is no operator<< for std::array, so VERIFY_IS_EQUAL will
301   // not compile
302   VERIFY((array_reverse(a) == b));
303   VERIFY((array_reverse(b) == a));
304   VERIFY_IS_EQUAL((array_sum(a)), 108);
305   VERIFY_IS_EQUAL((array_sum(b)), 108);
306   VERIFY_IS_EQUAL((array_prod(a)), 7418880);
307   VERIFY_IS_EQUAL((array_prod(b)), 7418880);
308 }
309 
test_array_zip_and_apply()310 static void test_array_zip_and_apply()
311 {
312   array<int, 6> a{{4, 8, 15, 16, 23, 42}};
313   array<int, 6> b{{0, 1, 2, 3, 4, 5}};
314   array<int, 6> c{{4, 9, 17, 19, 27, 47}};
315   array<int, 6> d{{0, 8, 30, 48, 92, 210}};
316   array<int, 6> e{{0, 2, 4, 6, 8, 10}};
317 
318   VERIFY((array_zip<sum_op>(a, b) == c));
319   VERIFY((array_zip<product_op>(a, b) == d));
320   VERIFY((array_apply<times2_op>(b) == e));
321   VERIFY_IS_EQUAL((array_apply_and_reduce<sum_op, times2_op>(a)), 216);
322   VERIFY_IS_EQUAL((array_apply_and_reduce<sum_op, times2_op>(b)), 30);
323   VERIFY_IS_EQUAL((array_zip_and_reduce<product_op, sum_op>(a, b)), 14755932);
324   VERIFY_IS_EQUAL((array_zip_and_reduce<sum_op, product_op>(a, b)), 388);
325 }
326 
test_array_misc()327 static void test_array_misc()
328 {
329   array<int, 3> a3{{1, 1, 1}};
330   array<int, 6> a6{{2, 2, 2, 2, 2, 2}};
331   VERIFY((repeat<3, int>(1) == a3));
332   VERIFY((repeat<6, int>(2) == a6));
333 
334   int data[5] = { 0, 1, 2, 3, 4 };
335   VERIFY_IS_EQUAL((instantiate_by_c_array<dummy_inst, int, 0>(data).c), 0);
336   VERIFY_IS_EQUAL((instantiate_by_c_array<dummy_inst, int, 1>(data).c), 1);
337   VERIFY_IS_EQUAL((instantiate_by_c_array<dummy_inst, int, 2>(data).c), 2);
338   VERIFY_IS_EQUAL((instantiate_by_c_array<dummy_inst, int, 3>(data).c), 3);
339   VERIFY_IS_EQUAL((instantiate_by_c_array<dummy_inst, int, 4>(data).c), 4);
340   VERIFY_IS_EQUAL((instantiate_by_c_array<dummy_inst, int, 5>(data).c), 5);
341 }
342 
test_cxx11_meta()343 void test_cxx11_meta()
344 {
345   CALL_SUBTEST(test_gen_numeric_list());
346   CALL_SUBTEST(test_concat());
347   CALL_SUBTEST(test_slice());
348   CALL_SUBTEST(test_get());
349   CALL_SUBTEST(test_id());
350   CALL_SUBTEST(test_is_same_gf());
351   CALL_SUBTEST(test_apply_op());
352   CALL_SUBTEST(test_contained_in_list());
353   CALL_SUBTEST(test_arg_reductions());
354   CALL_SUBTEST(test_array_reverse_and_reduce());
355   CALL_SUBTEST(test_array_zip_and_apply());
356   CALL_SUBTEST(test_array_misc());
357 }
358