source: NonGTP/Boost/boost/python/tuple.hpp @ 857

Revision 857, 1.8 KB checked in by igarcia, 19 years ago (diff)
Line 
1// Copyright David Abrahams 2002.
2// Distributed under the Boost Software License, Version 1.0. (See
3// accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5#ifndef TUPLE_20020706_HPP
6#define TUPLE_20020706_HPP
7
8# include <boost/python/detail/prefix.hpp>
9
10#include <boost/python/object.hpp>
11#include <boost/python/converter/pytype_object_mgr_traits.hpp>
12#include <boost/preprocessor/enum_params.hpp>
13#include <boost/preprocessor/repetition/enum_binary_params.hpp>
14
15namespace boost { namespace python {
16
17namespace detail
18{
19  struct BOOST_PYTHON_DECL tuple_base : object
20  {
21   protected:
22      tuple_base();
23      tuple_base(object_cref sequence);
24     
25      BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(tuple_base, object)
26
27   private:
28      static detail::new_reference call(object const&);
29  };
30}
31
32class tuple : public detail::tuple_base
33{
34    typedef detail::tuple_base base;
35 public:
36    tuple() {}
37
38    template <class T>
39    explicit tuple(T const& sequence)
40        : base(object(sequence))
41    {
42    }
43
44 public: // implementation detail -- for internal use only
45    BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(tuple, base)
46};
47
48//
49// Converter Specializations    // $$$ JDG $$$ moved here to prevent
50//                              // G++ bug complaining specialization
51                                // provided after instantiation
52namespace converter
53{
54  template <>
55  struct object_manager_traits<tuple>
56      : pytype_object_manager_traits<&PyTuple_Type,tuple>
57  {
58  };
59}
60
61// for completeness
62inline tuple make_tuple() { return tuple(); }
63
64# define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PYTHON_MAX_ARITY, <boost/python/detail/make_tuple.hpp>))
65# include BOOST_PP_ITERATE()
66
67}}  // namespace boost::python
68
69#endif
70
Note: See TracBrowser for help on using the repository browser.