1/*=============================================================================
2 Copyright (c) 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#ifndef BOOST_FUNCTIONAL_VALUE_FACTORY_HPP_INCLUDED
10# ifndef BOOST_PP_IS_ITERATING
11
12# include <boost/preprocessor/iteration/iterate.hpp>
13# include <boost/preprocessor/repetition/enum_params.hpp>
14# include <boost/preprocessor/repetition/enum_binary_params.hpp>
15
16# include <new>
17# include <boost/pointee.hpp>
18# include <boost/get_pointer.hpp>
19# include <boost/non_type.hpp>
20# include <boost/type_traits/remove_cv.hpp>
21
22# ifndef BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY
23# define BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY 10
24# elif BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY < 3
25# undef BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY
26# define BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY 3
27# endif
28
29namespace boost
30{
31 template< typename T >
32 class value_factory;
33
34 //----- ---- --- -- - - - -
35
36 template< typename T >
37 class value_factory
38 {
39 public:
40 typedef T result_type;
41
42 value_factory()
43 { }
44
45# define BOOST_PP_FILENAME_1 <boost/functional/value_factory.hpp>
46# define BOOST_PP_ITERATION_LIMITS (0,BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY)
47# include BOOST_PP_ITERATE()
48 };
49
50 template< typename T > class value_factory<T&>;
51 // forbidden, would create a dangling reference
52}
53# define BOOST_FUNCTIONAL_VALUE_FACTORY_HPP_INCLUDED
54# else // defined(BOOST_PP_IS_ITERATING)
55
56# define N BOOST_PP_ITERATION()
57# if N > 0
58 template< BOOST_PP_ENUM_PARAMS(N, typename T) >
59# endif
60 inline result_type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) const
61 {
62 return result_type(BOOST_PP_ENUM_PARAMS(N,a));
63 }
64# undef N
65
66# endif // defined(BOOST_PP_IS_ITERATING)
67
68#endif // include guard
69
70

source code of boost/boost/functional/value_factory.hpp