blob: d08b9cbb98922ae1321f5d62657449c2a378007e [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001
2// (C) Copyright Tobias Schwinger
3//
4// Use modification and distribution are subject to the boost Software License,
5// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
6
7//------------------------------------------------------------------------------
8
9// no include guards, this file is intended for multiple inclusion
10
Jeff Thompson3d613fd2013-10-15 15:39:04 -070011#if NDNBOOST_FT_ARITY_LOOP_PREFIX
Jeff Thompsona28eed82013-08-22 16:21:10 -070012
Jeff Thompson3d613fd2013-10-15 15:39:04 -070013# ifndef NDNBOOST_FT_DETAIL_SYNTHESIZE_IMPL_MASTER_HPP_INCLUDED
14# define NDNBOOST_FT_DETAIL_SYNTHESIZE_IMPL_MASTER_HPP_INCLUDED
Jeff Thompsona28eed82013-08-22 16:21:10 -070015# include <ndnboost/preprocessor/cat.hpp>
16# include <ndnboost/preprocessor/arithmetic/dec.hpp>
17# include <ndnboost/preprocessor/iteration/local.hpp>
18# include <ndnboost/preprocessor/facilities/empty.hpp>
19# include <ndnboost/preprocessor/facilities/identity.hpp>
20# endif
21
Jeff Thompson3d613fd2013-10-15 15:39:04 -070022# define NDNBOOST_FT_type_name type
Jeff Thompsona28eed82013-08-22 16:21:10 -070023
Jeff Thompson3d613fd2013-10-15 15:39:04 -070024# ifdef NDNBOOST_FT_flags
25# define NDNBOOST_FT_make_type(flags,cc,arity) NDNBOOST_FT_make_type_impl(flags,cc,arity)
26# define NDNBOOST_FT_make_type_impl(flags,cc,arity) make_type_ ## flags ## _ ## cc ## _ ## arity
Jeff Thompsona28eed82013-08-22 16:21:10 -070027# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070028NDNBOOST_PP_EXPAND(#) define NDNBOOST_FT_make_type(flags,cc,arity) NDNBOOST_FT_make_type_impl(flags,cc,arity)
29NDNBOOST_PP_EXPAND(#) define NDNBOOST_FT_make_type_impl(flags,cc,arity) make_type_ ## flags ## _ ## cc ## _ ## arity
Jeff Thompsona28eed82013-08-22 16:21:10 -070030# endif
31
Jeff Thompson3d613fd2013-10-15 15:39:04 -070032# define NDNBOOST_FT_iter(i) NDNBOOST_PP_CAT(iter_,i)
Jeff Thompsona28eed82013-08-22 16:21:10 -070033
Jeff Thompson3d613fd2013-10-15 15:39:04 -070034#elif NDNBOOST_FT_ARITY_LOOP_IS_ITERATING
Jeff Thompsona28eed82013-08-22 16:21:10 -070035
Jeff Thompson3d613fd2013-10-15 15:39:04 -070036template< NDNBOOST_FT_tplargs(NDNBOOST_PP_IDENTITY(typename)) >
37struct NDNBOOST_FT_make_type(NDNBOOST_FT_flags,NDNBOOST_FT_cc_id,NDNBOOST_FT_arity)
Jeff Thompsona28eed82013-08-22 16:21:10 -070038{
Jeff Thompson3d613fd2013-10-15 15:39:04 -070039 typedef NDNBOOST_FT_type ;
Jeff Thompsona28eed82013-08-22 16:21:10 -070040};
41
42template<>
Jeff Thompson3d613fd2013-10-15 15:39:04 -070043struct synthesize_impl_o< NDNBOOST_FT_flags, NDNBOOST_FT_cc_id, NDNBOOST_FT_n >
Jeff Thompsona28eed82013-08-22 16:21:10 -070044{
45 template<typename S> struct synthesize_impl_i
46 {
47 private:
Jeff Thompson3d613fd2013-10-15 15:39:04 -070048 typedef typename mpl::begin<S>::type NDNBOOST_FT_iter(0);
49# if NDNBOOST_FT_n > 1
50# define NDNBOOST_PP_LOCAL_MACRO(i) typedef typename mpl::next< \
51 NDNBOOST_FT_iter(NDNBOOST_PP_DEC(i)) >::type NDNBOOST_FT_iter(i);
52# define NDNBOOST_PP_LOCAL_LIMITS (1,NDNBOOST_FT_n-1)
53# include NDNBOOST_PP_LOCAL_ITERATE()
Jeff Thompsona28eed82013-08-22 16:21:10 -070054# endif
55 public:
Jeff Thompson3d613fd2013-10-15 15:39:04 -070056 typedef typename detail::NDNBOOST_FT_make_type(NDNBOOST_FT_flags,NDNBOOST_FT_cc_id,NDNBOOST_FT_arity)
57 < typename mpl::deref< NDNBOOST_FT_iter(0) >::type
58# if NDNBOOST_FT_mfp
Jeff Thompsona28eed82013-08-22 16:21:10 -070059 , typename detail::cv_traits<
Jeff Thompson3d613fd2013-10-15 15:39:04 -070060 typename mpl::deref< NDNBOOST_FT_iter(1) >::type >::type
Jeff Thompsona28eed82013-08-22 16:21:10 -070061# endif
Jeff Thompson3d613fd2013-10-15 15:39:04 -070062# if NDNBOOST_FT_n > (NDNBOOST_FT_mfp+1)
63# define NDNBOOST_PP_LOCAL_LIMITS (NDNBOOST_FT_mfp+1,NDNBOOST_FT_n-1)
64# define NDNBOOST_PP_LOCAL_MACRO(i) \
65 , typename mpl::deref< NDNBOOST_FT_iter(i) >::type
66# include NDNBOOST_PP_LOCAL_ITERATE()
Jeff Thompsona28eed82013-08-22 16:21:10 -070067# endif
68 >::type type;
69 };
70};
71
Jeff Thompson3d613fd2013-10-15 15:39:04 -070072#elif NDNBOOST_FT_ARITY_LOOP_SUFFIX
Jeff Thompsona28eed82013-08-22 16:21:10 -070073
Jeff Thompson3d613fd2013-10-15 15:39:04 -070074# ifdef NDNBOOST_FT_flags
75# undef NDNBOOST_FT_make_type
76# undef NDNBOOST_FT_make_type_impl
Jeff Thompsona28eed82013-08-22 16:21:10 -070077# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070078NDNBOOST_PP_EXPAND(#) undef NDNBOOST_FT_make_type
79NDNBOOST_PP_EXPAND(#) undef NDNBOOST_FT_make_type_impl
Jeff Thompsona28eed82013-08-22 16:21:10 -070080# endif
Jeff Thompson3d613fd2013-10-15 15:39:04 -070081# undef NDNBOOST_FT_iter
82# undef NDNBOOST_FT_type_name
Jeff Thompsona28eed82013-08-22 16:21:10 -070083
84#else
85# error "attempt to use arity loop master file without loop"
86#endif
87