~tsarev/boostdc/cmake

« back to all changes in this revision

Viewing changes to boost/boost/fusion/functional/adapter/unfused_rvalue_args.hpp

  • Committer: bigmuscle
  • Date: 2010-05-08 08:47:15 UTC
  • Revision ID: svn-v4:5fb55d53-692c-0410-a46a-e90ab66e00ee:trunk:497
removed old boost version

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*=============================================================================
2
 
    Copyright (c) 2006-2007 Tobias Schwinger
3
 
  
4
 
    Use modification and distribution are subject to the Boost Software 
5
 
    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6
 
    http://www.boost.org/LICENSE_1_0.txt).
7
 
==============================================================================*/
8
 
 
9
 
#if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_RVALUE_ARGS_HPP_INCLUDED)
10
 
#if !defined(BOOST_PP_IS_ITERATING)
11
 
 
12
 
#include <boost/preprocessor/cat.hpp>
13
 
#include <boost/preprocessor/iteration/iterate.hpp>
14
 
#include <boost/preprocessor/repetition/enum_params.hpp>
15
 
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
16
 
#include <boost/preprocessor/facilities/intercept.hpp>
17
 
 
18
 
#include <boost/utility/result_of.hpp>
19
 
 
20
 
#include <boost/fusion/container/vector/vector.hpp>
21
 
 
22
 
#include <boost/fusion/functional/adapter/limits.hpp>
23
 
#include <boost/fusion/functional/adapter/detail/access.hpp>
24
 
 
25
 
namespace boost { namespace fusion
26
 
{
27
 
    template <class Function> class unfused_rvalue_args;
28
 
 
29
 
    //----- ---- --- -- - -  -   -
30
 
 
31
 
    template <class Function> class unfused_rvalue_args
32
 
    {
33
 
        Function fnc_transformed;
34
 
 
35
 
        typedef typename detail::qf_c<Function>::type function_c;
36
 
        typedef typename detail::qf<Function>::type function;
37
 
 
38
 
        typedef typename detail::call_param<Function>::type func_const_fwd_t;
39
 
 
40
 
      public:
41
 
 
42
 
        inline explicit unfused_rvalue_args(func_const_fwd_t f = function())
43
 
            : fnc_transformed(f)
44
 
        { }
45
 
 
46
 
        template <typename Sig>
47
 
        struct result;
48
 
 
49
 
        typedef typename boost::result_of<
50
 
            function_c(fusion::vector0 &) >::type call_const_0_result;
51
 
 
52
 
        inline call_const_0_result operator()() const
53
 
        {
54
 
            fusion::vector0 arg;
55
 
            return this->fnc_transformed(arg);
56
 
        }
57
 
 
58
 
        typedef typename boost::result_of< 
59
 
            function(fusion::vector0 &) >::type call_0_result;
60
 
 
61
 
        inline call_0_result operator()() 
62
 
        {
63
 
            fusion::vector0 arg;
64
 
            return this->fnc_transformed(arg);
65
 
        }
66
 
 
67
 
        #define  BOOST_PP_FILENAME_1 \
68
 
            <boost/fusion/functional/adapter/unfused_rvalue_args.hpp>
69
 
        #define  BOOST_PP_ITERATION_LIMITS \
70
 
            (1,BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY)
71
 
        #include BOOST_PP_ITERATE()
72
 
    };
73
 
}}
74
 
 
75
 
namespace boost 
76
 
{
77
 
    template<class F>
78
 
    struct result_of<boost::fusion::unfused_rvalue_args<F> const ()>
79
 
    {
80
 
        typedef typename boost::fusion::unfused_rvalue_args<F>::call_const_0_result type;
81
 
    };
82
 
    template<class F>
83
 
    struct result_of<boost::fusion::unfused_rvalue_args<F>()>
84
 
    {
85
 
        typedef typename boost::fusion::unfused_rvalue_args<F>::call_0_result type;
86
 
    };
87
 
}
88
 
 
89
 
#define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_RVALUE_ARGS_HPP_INCLUDED
90
 
#else // defined(BOOST_PP_IS_ITERATING)
91
 
////////////////////////////////////////////////////////////////////////////////
92
 
//
93
 
//  Preprocessor vertical repetition code
94
 
//
95
 
////////////////////////////////////////////////////////////////////////////////
96
 
#define N BOOST_PP_ITERATION()
97
 
 
98
 
        template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
99
 
        struct result< Self const (BOOST_PP_ENUM_PARAMS(N,T)) >
100
 
            : boost::result_of< function_c(
101
 
                BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,
102
 
                    typename detail::cref<T,>::type BOOST_PP_INTERCEPT) > & )>
103
 
        { };
104
 
 
105
 
        template <class Self, BOOST_PP_ENUM_PARAMS(N,typename T)>
106
 
        struct result< Self (BOOST_PP_ENUM_PARAMS(N,T)) >
107
 
            : boost::result_of< function(
108
 
                BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N,
109
 
                    typename detail::cref<T,>::type BOOST_PP_INTERCEPT) > & )>
110
 
        { };
111
 
 
112
 
        template <BOOST_PP_ENUM_PARAMS(N,typename T)>
113
 
        inline typename boost::result_of<function_c(BOOST_PP_CAT(fusion::vector,N)
114
 
            <BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT)> & )>::type
115
 
        operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& a)) const
116
 
        {
117
 
            BOOST_PP_CAT(fusion::vector,N)<
118
 
                  BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT) >
119
 
                arg(BOOST_PP_ENUM_PARAMS(N,a));
120
 
            return this->fnc_transformed(arg);
121
 
        }
122
 
 
123
 
        template <BOOST_PP_ENUM_PARAMS(N,typename T)>
124
 
        inline typename boost::result_of<function(BOOST_PP_CAT(fusion::vector,N)
125
 
            <BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT)> & )>::type
126
 
        operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& a)) 
127
 
        {
128
 
            BOOST_PP_CAT(fusion::vector,N)<
129
 
                  BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& BOOST_PP_INTERCEPT) >
130
 
                arg(BOOST_PP_ENUM_PARAMS(N,a));
131
 
            return this->fnc_transformed(arg);
132
 
        }
133
 
 
134
 
#undef N
135
 
#endif // defined(BOOST_PP_IS_ITERATING)
136
 
#endif
137