Ticket #2235: tr1_tuple_list_of.hpp

File tr1_tuple_list_of.hpp, 1.9 KB (added by markus_werle, 14 years ago)

compilable tr1_tuple_list_of implementation sketch

Line 
1// Boost.Assign library extension
2//
3// Copyright Markus Werle 2008. Use, modification and
4// distribution is subject to the Boost Software License, Version
5// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6// http://www.boost.org/LICENSE_1_0.txt)
7//
8// For more information, see http://www.boost.org/libs/assign/
9//
10
11
12#ifndef BOOST_ASSIGN_TR1_LIST_OF_HPP
13#define BOOST_ASSIGN_TR1_LIST_OF_HPP
14
15#if defined(_MSC_VER) && (_MSC_VER >= 1020)
16# pragma once
17#endif
18
19#include <boost/assign/list_of.hpp>
20#include <boost/tr1/tuple.hpp>
21
22#ifndef BOOST_ASSIGN_MAX_PARAMS // use user's value
23#define BOOST_ASSIGN_MAX_PARAMS 5
24#endif
25#define BOOST_ASSIGN_MAX_PARAMETERS (BOOST_ASSIGN_MAX_PARAMS - 1)
26#define BOOST_ASSIGN_PARAMS1(n) BOOST_PP_ENUM_PARAMS(n, class U)
27#define BOOST_ASSIGN_PARAMS2(n) BOOST_PP_ENUM_BINARY_PARAMS(n, U, const& u)
28#define BOOST_ASSIGN_PARAMS3(n) BOOST_PP_ENUM_PARAMS(n, u)
29#define BOOST_ASSIGN_PARAMS4(n) BOOST_PP_ENUM_PARAMS(n, U)
30#define BOOST_ASSIGN_PARAMS2_NO_REF(n) BOOST_PP_ENUM_BINARY_PARAMS(n, U, u)
31
32namespace boost
33{
34
35namespace assign
36{
37
38#define BOOST_PP_LOCAL_LIMITS (1, BOOST_ASSIGN_MAX_PARAMETERS)
39#define BOOST_PP_LOCAL_MACRO(n) \
40 template< class U, BOOST_ASSIGN_PARAMS1(n) > \
41 inline assign_detail::generic_list< std::tr1::tuple<U, BOOST_ASSIGN_PARAMS4(n)> > \
42 tr1_tuple_list_of(U u, BOOST_ASSIGN_PARAMS2_NO_REF(n) ) \
43 { \
44 return assign_detail::generic_list< std::tr1::tuple<U, BOOST_ASSIGN_PARAMS4(n)> >()( std::tr1::tuple<U,BOOST_ASSIGN_PARAMS4(n)>( u, BOOST_ASSIGN_PARAMS3(n) )); \
45 } \
46 /**/
47
48#include BOOST_PP_LOCAL_ITERATE()
49
50
51} // namespace 'assign'
52} // namespace 'boost'
53
54
55#undef BOOST_ASSIGN_PARAMS1
56#undef BOOST_ASSIGN_PARAMS2
57#undef BOOST_ASSIGN_PARAMS3
58#undef BOOST_ASSIGN_PARAMS4
59#undef BOOST_ASSIGN_PARAMS2_NO_REF
60#undef BOOST_ASSIGN_MAX_PARAMETERS
61
62#endif