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/none_t.hpp> |
---|
19 | # include <boost/get_pointer.hpp> |
---|
20 | # include <boost/non_type.hpp> |
---|
21 | # include <boost/type_traits/remove_cv.hpp> |
---|
22 | |
---|
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 |
---|
28 | # endif |
---|
29 | |
---|
30 | namespace boost |
---|
31 | { |
---|
32 | template< typename T > |
---|
33 | class value_factory; |
---|
34 | |
---|
35 | //----- ---- --- -- - - - - |
---|
36 | |
---|
37 | template< typename T > |
---|
38 | class value_factory |
---|
39 | { |
---|
40 | public: |
---|
41 | typedef T result_type; |
---|
42 | |
---|
43 | value_factory() |
---|
44 | { } |
---|
45 | |
---|
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() |
---|
49 | }; |
---|
50 | |
---|
51 | template< typename T > class value_factory<T&>; |
---|
52 | // forbidden, would create a dangling reference |
---|
53 | } |
---|
54 | # define BOOST_FUNCTIONAL_VALUE_FACTORY_HPP_INCLUDED |
---|
55 | # else // defined(BOOST_PP_IS_ITERATING) |
---|
56 | |
---|
57 | # define N BOOST_PP_ITERATION() |
---|
58 | # if N > 0 |
---|
59 | template< BOOST_PP_ENUM_PARAMS(N, typename T) > |
---|
60 | # endif |
---|
61 | inline result_type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) const |
---|
62 | { |
---|
63 | return result_type(BOOST_PP_ENUM_PARAMS(N,a)); |
---|
64 | } |
---|
65 | # undef N |
---|
66 | |
---|
67 | # endif // defined(BOOST_PP_IS_ITERATING) |
---|
68 | |
---|
69 | #endif // include guard |
---|
70 | |
---|