OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
create_vmpl_sequence.hpp
1 /*
2  * mpl_sequence.hpp
3  *
4  * Set of classes to create an mpl::vector with a filled sequence
5  *
6  * Created on: Aug 27, 2014
7  * Author: Pietro Incardona
8  */
9 
10 #ifndef MPL_SEQUENCE_HPP
11 #define MPL_SEQUENCE_HPP
12 
13 #include <boost/mpl/int.hpp>
14 #include <boost/mpl/reverse.hpp>
15 
25 template<int c,int end>
26 struct exit_impl : boost::mpl::equal_to<boost::mpl::int_<c>,boost::mpl::int_<end>>
27 {};
28 
37 template<class H, int c , int end, bool exit>
39 {
40  typedef typename exit_impl<c,end>::type exit_;
41  typedef typename boost::mpl::push_back<H,boost::mpl::int_<c>> v;
42  typedef typename to_variadic_impl<v,c+1,end,exit_::value>::type type;
43 };
44 
45 
47 template<template<typename> class H,typename F,typename L>
48 struct to_variadic_impl<H,F,L,true>
49 {
50  typedef H type;
51 };
52 
53 template<typename Seq>
55 {
56  typedef typename boost::mpl::begin<Seq>::type first_;
57  typedef typename boost::mpl::end<Seq>::type last_;
58  typedef typename exit_impl<first_,last_>::type exit_;
59 };
60 
78 template<unsigned int N, unsigned int M>
80 {
82  typedef typename exit_impl<N,M>::type exit_;
83 
85  typedef boost::mpl::vector<boost::mpl::int_<N>> vi;
86 
88  typedef typename to_variadic_impl<vi,N+1,M,exit_::value >::type type;
89 };
90 
91 
92 #endif
Recursive specialization of to_variadic.
boost::mpl::vector< boost::mpl::int_< N > > vi
starting vector type
implementation of seq_traits
exit_impl< N, M >::type exit_
end condition
to_variadic_impl< vi, N+1, M, exit_::value >::type type
generate the boost::fusion::vector apply H on each term
Exit condition.
[v_transform metafunction]