File indexing completed on 2024-11-15 09:29:43
0001
0002
0003
0004
0005 #ifndef TUPLE_20020706_HPP
0006 #define TUPLE_20020706_HPP
0007
0008 # include <boost/python/detail/prefix.hpp>
0009
0010 #include <boost/python/object.hpp>
0011 #include <boost/python/converter/pytype_object_mgr_traits.hpp>
0012 #include <boost/preprocessor/enum_params.hpp>
0013 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
0014
0015 namespace boost { namespace python {
0016
0017 namespace detail
0018 {
0019 struct BOOST_PYTHON_DECL tuple_base : object
0020 {
0021 protected:
0022 tuple_base();
0023 tuple_base(object_cref sequence);
0024
0025 BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(tuple_base, object)
0026
0027 private:
0028 static detail::new_reference call(object const&);
0029 };
0030 }
0031
0032 class tuple : public detail::tuple_base
0033 {
0034 typedef detail::tuple_base base;
0035 public:
0036 tuple() {}
0037
0038 template <class T>
0039 explicit tuple(T const& sequence)
0040 : base(object(sequence))
0041 {
0042 }
0043
0044 public:
0045 BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(tuple, base)
0046 };
0047
0048
0049
0050
0051
0052 namespace converter
0053 {
0054 template <>
0055 struct object_manager_traits<tuple>
0056 : pytype_object_manager_traits<&PyTuple_Type,tuple>
0057 {
0058 };
0059 }
0060
0061
0062 inline tuple make_tuple() { return tuple(); }
0063
0064 # define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PYTHON_MAX_ARITY, <boost/python/detail/make_tuple.hpp>))
0065 # include BOOST_PP_ITERATE()
0066
0067 }}
0068
0069 #endif
0070