source: NonGTP/Boost/boost/spirit/fusion/sequence/make_tuple.hpp @ 857

Revision 857, 2.0 KB checked in by igarcia, 19 years ago (diff)
Line 
1/*=============================================================================
2    Copyright (c) 1999-2003 Jaakko Järvi
3    Copyright (c) 2001-2003 Joel de Guzman
4
5    Use, modification and distribution is subject to the Boost Software
6    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7    http://www.boost.org/LICENSE_1_0.txt)
8==============================================================================*/
9#if !defined(FUSION_SEQUENCE_MAKE_TUPLE_HPP)
10#define FUSION_SEQUENCE_MAKE_TUPLE_HPP
11
12#include <boost/preprocessor/repetition/enum.hpp>
13#include <boost/preprocessor/repetition/enum_params.hpp>
14#include <boost/preprocessor/repetition/enum_binary_params.hpp>
15#include <boost/preprocessor/repetition/repeat_from_to.hpp>
16#include <boost/spirit/fusion/sequence/tuple.hpp>
17#include <boost/spirit/fusion/sequence/detail/as_tuple_element.hpp>
18
19namespace boost { namespace fusion
20{
21    inline tuple<>
22    make_tuple()
23    {
24        return tuple<>();
25    }
26
27#define BOOST_FUSION_AS_TUPLE_ELEMENT(z, n, data)                               \
28    BOOST_DEDUCED_TYPENAME detail::as_tuple_element<BOOST_PP_CAT(T, n)>::type
29
30#define FUSION_MAKE_TUPLE(z, n, _)                                              \
31                                                                                \
32    template <BOOST_PP_ENUM_PARAMS(n, typename T)>                              \
33    inline tuple<BOOST_PP_ENUM(n, BOOST_FUSION_AS_TUPLE_ELEMENT, _)>            \
34    make_tuple(BOOST_PP_ENUM_BINARY_PARAMS(n, T, const& _))                     \
35    {                                                                           \
36        return tuple<BOOST_PP_ENUM(n, BOOST_FUSION_AS_TUPLE_ELEMENT, _)>(       \
37            BOOST_PP_ENUM_PARAMS(n, _));                                        \
38    }
39
40    BOOST_PP_REPEAT_FROM_TO(1, FUSION_MAX_TUPLE_SIZE, FUSION_MAKE_TUPLE, _)
41
42#undef BOOST_FUSION_AS_TUPLE_ELEMENT
43#undef FUSION_MAKE_TUPLE
44
45}}
46
47#endif
Note: See TracBrowser for help on using the repository browser.