OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
variadic_to_vmpl_unit_test.hpp
1 /*
2  * variadic_to_vmpl_unit_test.hpp
3  *
4  * Created on: Aug 19, 2015
5  * Author: i-bird
6  */
7 
8 #ifndef SRC_UTIL_VARIADIC_TO_VMPL_UNIT_TEST_HPP_
9 #define SRC_UTIL_VARIADIC_TO_VMPL_UNIT_TEST_HPP_
10 
11 #include "util/variadic_to_vmpl.hpp"
12 #include "util/util_debug.hpp"
13 #include <typeinfo>
14 
16 template <typename T>
17 struct F
18 {
20  typedef aggregate<T> type;
21 };
23 
25 template <typename arg0, typename T>
26 struct Ftwo
27 {
29  typedef aggregate<T> type;
30 };
32 
33 BOOST_AUTO_TEST_CASE( variadic_to_vmpl_test)
34 {
35  {
37 
38  typedef boost::mpl::vector<float,float,float[3]> bfv;
39 
40  // tbvf is boost::fusion::vector<scalar<float>,scalar<float>,scalar<float[3]>>
41  typedef v_transform<F,bfv>::type tbfv;
42 
43  bool val = std::is_same<boost::mpl::at<tbfv,boost::mpl::int_<0>>::type,aggregate<float>>::value;
44  BOOST_REQUIRE_EQUAL(val,true);
45 
46  val = std::is_same<boost::mpl::at<tbfv,boost::mpl::int_<1>>::type,aggregate<float>>::value;
47  BOOST_REQUIRE_EQUAL(val,true);
48 
49  val = std::is_same<boost::mpl::at<tbfv,boost::mpl::int_<2>>::type,aggregate<float[3]>>::value;
50  BOOST_REQUIRE_EQUAL(val,true);
51 
53  }
54 
55  {
57 
58  typedef boost::mpl::vector<float,float,float[3]> bfv;
59 
60  // tbvf is boost::fusion::vector<scalar<float>,scalar<float>,scalar<float[3]>>
62 
63  bool val = std::is_same<boost::mpl::at<tbfv,boost::mpl::int_<0>>::type,aggregate<float>>::value;
64  BOOST_REQUIRE_EQUAL(val,true);
65 
66  val = std::is_same<boost::mpl::at<tbfv,boost::mpl::int_<1>>::type,aggregate<float>>::value;
67  BOOST_REQUIRE_EQUAL(val,true);
68 
69  val = std::is_same<boost::mpl::at<tbfv,boost::mpl::int_<2>>::type,aggregate<float[3]>>::value;
70  BOOST_REQUIRE_EQUAL(val,true);
71 
73  }
74 
75  {
77 
78  typedef to_boost_vmpl<1,4,5,9>::type bfv;
79 
80  bool val = std::is_same<boost::mpl::at<bfv,boost::mpl::int_<0>>::type,boost::mpl::int_<1>>::value;
81  BOOST_REQUIRE_EQUAL(val,true);
82 
83  val = std::is_same<boost::mpl::at<bfv,boost::mpl::int_<1>>::type,boost::mpl::int_<4>>::value;
84  BOOST_REQUIRE_EQUAL(val,true);
85 
86  val = std::is_same<boost::mpl::at<bfv,boost::mpl::int_<2>>::type,boost::mpl::int_<5>>::value;
87  BOOST_REQUIRE_EQUAL(val,true);
88 
89  val = std::is_same<boost::mpl::at<bfv,boost::mpl::int_<3>>::type,boost::mpl::int_<9>>::value;
90  BOOST_REQUIRE_EQUAL(val,true);
91 
93  }
94 }
95 
96 
97 #endif /* SRC_UTIL_VARIADIC_TO_VMPL_UNIT_TEST_HPP_ */
aggregate< T > type
meta-function implementation
aggregate< T > type
meta-function implementation
v_transform_impl< H, first, last, exit_::value >::type type
generate the boost::fusion::vector apply H on each term
to_boost_vmpl_impl< id...>::type type
constrict an mpl vector from the variadic
v_transform_two_impl< H, arg0, first, last, exit_::value >::type type
generate the boost::fusion::vector apply H on each term
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...
Definition: aggregate.hpp:81
[v_transform metafunction]
[v_transform metafunction]