to_python_value.qbk 1004 B

12345678910111213141516171819202122232425262728293031323334
  1. [section boost/python/to_python_value.hpp]
  2. [section Introduction]
  3. `to_python_value` is a model of [link concepts.resultconverter ResultConverter] which copies its argument into a new Python object.
  4. [endsect]
  5. [section Class template `to_python_value`]
  6. ``
  7. namespace boost { namespace python
  8. {
  9. template <class T>
  10. struct to_python_value
  11. {
  12. typedef typename add_reference<
  13. typename add_const<T>::type
  14. >::type argument_type;
  15. static bool convertible();
  16. PyObject* operator()(argument_type) const;
  17. };
  18. }}
  19. ``
  20. [endsect]
  21. [section Class `to_python_value` observers]
  22. ``static bool convertible();``
  23. [variablelist
  24. [[Returns][`true` iff a converter has been registered which can convert `T` to python by-value. ]]
  25. ]
  26. ``PyObject* operator()(argument_type x) const;``
  27. [variablelist
  28. [[Requires][`convertible() == true`]]
  29. [[Effects][converts `x` to python]]
  30. [[Returns][the resulting Python object iff a converter for `T` has been registered, `0` otherwise. ]]
  31. ]
  32. [endsect]
  33. [endsect]