OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
ct_array.hpp
1/*
2 * ct_array.hpp
3 *
4 * Created on: Aug 21, 2014
5 * Author: Pietro Incardona
6 */
7
8
9
18#ifndef CT_ARRAY_HPP_
19#define CT_ARRAY_HPP_
20
21
22#include <boost/fusion/mpl.hpp>
23
25
26template<int ...> struct index_tuple{};
27
29template<class T, int... args> struct ArrayHolder_indexes {
31 typedef index_tuple<args ... > type;
32};
33
35template<class T,long int N, size_t orig_N, template<size_t,size_t> class F, int... args>
38 typedef typename generate_indexes_impl<T,N-1,orig_N, F, F<N,orig_N>::value, args...>::result result;
39};
40
42template<class T, size_t orig_N, template<size_t,size_t> class F, int... args>
43struct generate_indexes_impl<T,0,orig_N, F, args...> {
45 typedef typename ArrayHolder_indexes<T,F<0,orig_N>::value, args...>::type result;
46};
47
49template<class T, size_t orig_N, template<size_t,size_t> class F, int... args>
50struct generate_indexes_impl<T,-1,orig_N, F, args...> {
53};
54
68template<class T, long int N, template<size_t,size_t> class F>
71 typedef typename generate_indexes_impl<T,N-1, N, F>::result result;
72};
73
75
76#ifndef COVERTY_SCAN
77
79template<class T, unsigned long... args> struct ArrayHolder_constexpr {
81 constexpr static T data[sizeof...(args)] = { args... };
82};
83
84
86template<class T,size_t N, size_t orig_N, template<size_t,size_t> class F, unsigned... args>
89 typedef typename generate_array_constexpr_impl<T,N-1,orig_N, F, F<N,orig_N>::value, args...>::result result;
90};
91
93template<class T, size_t orig_N, template<size_t,size_t> class F, unsigned... args>
94struct generate_array_constexpr_impl<T,0,orig_N, F, args...> {
97};
98
119template<class T, size_t N, template<size_t,size_t> class F>
122 typedef typename generate_array_constexpr_impl<T,N-1, N, F>::result result;
123};
124
125#endif
126
128
130template<class T, unsigned long... args> struct ArrayHolder {
131 static const T data[sizeof...(args)];
132};
133
135template<class T, unsigned long... args>
136const T ArrayHolder<T,args...>::data[sizeof...(args)] = { args... };
137
139template<class T,size_t N, size_t orig_N, template<size_t,size_t> class F, unsigned... args>
142 typedef typename generate_array_impl<T,N-1,orig_N, F, F<N,orig_N>::value, args...>::result result;
143};
144
146template<class T, size_t orig_N, template<size_t,size_t> class F, unsigned... args>
147struct generate_array_impl<T,0,orig_N, F, args...> {
150};
151
170template<class T, size_t N, template<size_t,size_t> class F>
172 typedef typename generate_array_impl<T,N-1, N, F>::result result;
173};
174
176
178template<class T, size_t N ,class F, unsigned... args>
181 typedef typename generate_array_vector_impl<T,N-1,F, boost::mpl::at<F,boost::mpl::int_<N> >::type::value , args...>::result result;
182};
183
185template<class T, class F, unsigned... args>
186struct generate_array_vector_impl<T,0, F, args...> {
189};
190
207template<class T, class F>
211};
212
213#endif
the array itself
Definition ct_array.hpp:79
static constexpr T data[sizeof...(args)]
compile-time array
Definition ct_array.hpp:81
the array itself
Definition ct_array.hpp:29
index_tuple< args ... > type
convert variadic into a tuple struct containing the list
Definition ct_array.hpp:31
the array itself
Definition ct_array.hpp:130
static const T data[sizeof...(args)]
initialize the array from variadic template
Definition ct_array.hpp:131
[v_transform metafunction]
ArrayHolder_constexpr< T, F< 0, orig_N >::value, args... > result
Compile-time array.
Definition ct_array.hpp:96
recursive meta-function to generate compile-time array
Definition ct_array.hpp:87
generate_array_constexpr_impl< T, N-1, orig_N, F, F< N, orig_N >::value, args... >::result result
recursive meta-function to generate compile-time array
Definition ct_array.hpp:89
Main class to generate constexpr compile-time array.
Definition ct_array.hpp:120
generate_array_constexpr_impl< T, N-1, N, F >::result result
meta-function to generate compile time array
Definition ct_array.hpp:122
ArrayHolder< T, F< 0, orig_N >::value, args... > result
compile-time array
Definition ct_array.hpp:149
Generate the array specializing ArrayHolder.
Definition ct_array.hpp:140
generate_array_impl< T, N-1, orig_N, F, F< N, orig_N >::value, args... >::result result
recursive meta-function to generate compile-time array
Definition ct_array.hpp:142
ArrayHolder< T, boost::mpl::at< F, boost::mpl::int_< 0 > >::type::value, args... > result
compile-time array generation
Definition ct_array.hpp:188
Generate the array specializing ArrayHolder.
Definition ct_array.hpp:179
generate_array_vector_impl< T, N-1, F, boost::mpl::at< F, boost::mpl::int_< N > >::type::value, args... >::result result
recursive meta-function to generate compile-time array
Definition ct_array.hpp:181
Main class to generate an array from a boost::mpl::vector of numbers.
Definition ct_array.hpp:208
generate_array_vector_impl< T, boost::mpl::size< F >::value-1, F >::result result
generate compile-time array vector
Definition ct_array.hpp:210
Main class to generate compile-time array.
Definition ct_array.hpp:171
ArrayHolder_indexes< T, F< 0, orig_N >::value, args... >::type result
generate the compile-time array
Definition ct_array.hpp:45
generate compile time index array
Definition ct_array.hpp:36
generate_indexes_impl< T, N-1, orig_N, F, F< N, orig_N >::value, args... >::result result
Metafunction to generate indexes.
Definition ct_array.hpp:38
Main class to generate indexes data structure.
Definition ct_array.hpp:69
generate_indexes_impl< T, N-1, N, F >::result result
generate compile time array
Definition ct_array.hpp:71
These set of classes generate an array definition at compile-time.
Definition ct_array.hpp:26