source: NonGTP/Boost/boost/python/detail/make_tuple.hpp @ 857

Revision 857, 1.0 KB checked in by igarcia, 19 years ago (diff)
Line 
1# ifndef BOOST_PYTHON_SYNOPSIS
2# // Copyright David Abrahams 2002.
3# // Distributed under the Boost Software License, Version 1.0. (See
4# // accompanying file LICENSE_1_0.txt or copy at
5# // http://www.boost.org/LICENSE_1_0.txt)
6
7#  if !defined(BOOST_PP_IS_ITERATING)
8#   error Boost.Python - do not include this file!
9#  endif
10
11#  define N BOOST_PP_ITERATION()
12
13#  define BOOST_PYTHON_MAKE_TUPLE_ARG(z, N, ignored)    \
14    PyTuple_SET_ITEM(                                   \
15        result.ptr()                                    \
16        , N                                             \
17        , python::incref(python::object(a##N).ptr())    \
18        );
19
20    template <BOOST_PP_ENUM_PARAMS_Z(1, N, class A)>
21    tuple
22    make_tuple(BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, const& a))
23    {
24        tuple result((detail::new_reference)::PyTuple_New(N));
25        BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_MAKE_TUPLE_ARG, _)
26        return result;
27    }
28
29#  undef BOOST_PYTHON_MAKE_TUPLE_ARG
30
31#  undef N
32# endif // BOOST_PYTHON_SYNOPSIS
Note: See TracBrowser for help on using the repository browser.