OpenFPM_data  0.1.0
Project that contain the implementation and interfaces for basic structure like vectors, grids, graph ... .
 All Data Structures Namespaces Functions Variables Typedefs Friends
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 "data_type/scalar.hpp"
13 #include "util/util_debug.hpp"
14 #include <typeinfo>
15 
17 template <typename T>
18 struct F
19 {
20  typedef scalar<T> type;
21 };
23 
25 template <typename arg0, typename T>
26 struct Ftwo
27 {
28  typedef scalar<T> type;
29 };
31 
32 BOOST_AUTO_TEST_CASE( variadic_to_vmpl_test)
33 {
34  {
36 
37  typedef boost::mpl::vector<float,float,float[3]> bfv;
38 
39  // tbvf is boost::fusion::vector<scalar<float>,scalar<float>,scalar<float[3]>>
40  typedef v_transform<F,bfv>::type tbfv;
41 
42  bool val = std::is_same<boost::mpl::at<tbfv,boost::mpl::int_<0>>::type,scalar<float>>::value;
43  BOOST_REQUIRE_EQUAL(val,true);
44 
45  val = std::is_same<boost::mpl::at<tbfv,boost::mpl::int_<1>>::type,scalar<float>>::value;
46  BOOST_REQUIRE_EQUAL(val,true);
47 
48  val = std::is_same<boost::mpl::at<tbfv,boost::mpl::int_<2>>::type,scalar<float[3]>>::value;
49  BOOST_REQUIRE_EQUAL(val,true);
50 
52  }
53 
54  {
56 
57  typedef boost::mpl::vector<float,float,float[3]> bfv;
58 
59  // tbvf is boost::fusion::vector<scalar<float>,scalar<float>,scalar<float[3]>>
61 
62  bool val = std::is_same<boost::mpl::at<tbfv,boost::mpl::int_<0>>::type,scalar<float>>::value;
63  BOOST_REQUIRE_EQUAL(val,true);
64 
65  val = std::is_same<boost::mpl::at<tbfv,boost::mpl::int_<1>>::type,scalar<float>>::value;
66  BOOST_REQUIRE_EQUAL(val,true);
67 
68  val = std::is_same<boost::mpl::at<tbfv,boost::mpl::int_<2>>::type,scalar<float[3]>>::value;
69  BOOST_REQUIRE_EQUAL(val,true);
70 
72  }
73 }
74 
75 
76 #endif /* SRC_UTIL_VARIADIC_TO_VMPL_UNIT_TEST_HPP_ */
v_transform_impl< H, first, last, exit_::value >::type type
generate the boost::fusion::vector apply H on each term
v_transform_two_impl< H, arg0, first, last, exit_::value >::type type
generate the boost::fusion::vector apply H on each term
it define a scalar value compatible with grid_cpu , grid_gpu, vector, graph ...
Definition: scalar.hpp:20
[v_transform_two metafunction]
[v_transform metafunction]