tuple.qbk 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. [section boost/python/tuple.hpp]
  2. [section Introduction]
  3. Exposes a [link concepts.objectwrapper.typewrapper_concept_requirements TypeWrapper] for the Python [@http://www.python.org/doc/current/tut/node7.html#SECTION007300000000000000000`tuple`] type.
  4. [endsect]
  5. [section Class `tuple`]
  6. Exposes the interface of Python's built-in tuple type. The semantics of the constructors and member functions defined below can be fully understood by reading the [link concepts.objectwrapper.typewrapper_concept_requirements TypeWrapper] concept definition. Since tuple is publicly derived from [link object_wrappers.boost_python_object_hpp.class_object `object`], the public `object` interface applies to `tuple` instances as well.
  7. ``
  8. namespace boost { namespace python
  9. {
  10. class tuple : public object
  11. {
  12. // tuple() -> an empty tuple
  13. tuple();
  14. // tuple(sequence) -> tuple initialized from sequence's items
  15. template <class T>
  16. explicit tuple(T const& sequence)
  17. };
  18. }}
  19. ``
  20. [endsect]
  21. [section Function `make_tuple`]
  22. ``
  23. namespace boost { namespace python
  24. {
  25. tuple make_tuple();
  26. template <class A0>
  27. tuple make_tuple(A0 const& a0);
  28. template <class A0, class A1>
  29. tuple make_tuple(A0 const& a0, A1 const& a1);
  30. ...
  31. template <class A0, class A1,...class An>
  32. tuple make_tuple(A0 const& a0, A1 const& a1,...An const& an);
  33. }}
  34. ``
  35. [variablelist
  36. [[Effect][Constructs a new tuple object composed of `object(a0),
  37. object(a0),...object(an)`. ]]
  38. ]
  39. [endsect]
  40. [section Example]
  41. ``
  42. using namespace boost::python;
  43. tuple head_and_tail(object sequence)
  44. {
  45. return make_tuple(sequence[0],sequence[-1]);
  46. }
  47. ``
  48. [endsect]
  49. [endsect]