1 /*=============================================================================
2 Copyright (c) 2007 Tobias Schwinger
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 ==============================================================================*/
9 #ifndef BOOST_FUNCTIONAL_VALUE_FACTORY_HPP_INCLUDED
10 # ifndef BOOST_PP_IS_ITERATING
12 # include <boost/preprocessor/iteration/iterate.hpp>
13 # include <boost/preprocessor/repetition/enum_params.hpp>
14 # include <boost/preprocessor/repetition/enum_binary_params.hpp>
17 # include <boost/pointee.hpp>
18 # include <boost/none_t.hpp>
19 # include <boost/get_pointer.hpp>
20 # include <boost/non_type.hpp>
21 # include <boost/type_traits/remove_cv.hpp>
23 # ifndef BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY
24 # define BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY 10
25 # elif BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY < 3
26 # undef BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY
27 # define BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY 3
32 template< typename T
>
35 //----- ---- --- -- - - - -
37 template< typename T
>
41 typedef T result_type
;
46 # define BOOST_PP_FILENAME_1 <boost/functional/value_factory.hpp>
47 # define BOOST_PP_ITERATION_LIMITS (0,BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY)
48 # include BOOST_PP_ITERATE()
51 template< typename T
> class value_factory
<T
&>;
52 // forbidden, would create a dangling reference
54 # define BOOST_FUNCTIONAL_VALUE_FACTORY_HPP_INCLUDED
55 # else // defined(BOOST_PP_IS_ITERATING)
57 # define N BOOST_PP_ITERATION()
59 template< BOOST_PP_ENUM_PARAMS(N
, typename T
) >
61 inline result_type
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N
,T
,& a
)) const
63 return result_type(BOOST_PP_ENUM_PARAMS(N
,a
));
67 # endif // defined(BOOST_PP_IS_ITERATING)
69 #endif // include guard