blob: c9175198f72448bb51cd9ba0d476ea603e693040 [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001/*=============================================================================
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 <ndnboost/preprocessor/iteration/iterate.hpp>
13# include <ndnboost/preprocessor/repetition/enum_params.hpp>
14# include <ndnboost/preprocessor/repetition/enum_binary_params.hpp>
15
16# include <new>
17# include <ndnboost/pointee.hpp>
18# include <ndnboost/none_t.hpp>
19# include <ndnboost/get_pointer.hpp>
20# include <ndnboost/non_type.hpp>
21# include <ndnboost/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
30namespace ndnboost
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 <ndnboost/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