object.hpp 851 B

123456789101112131415161718192021222324252627
  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 OBJECT_DWA2002612_HPP
  6. # define OBJECT_DWA2002612_HPP
  7. # include <boost/python/ssize_t.hpp>
  8. # include <boost/python/object_core.hpp>
  9. # include <boost/python/object_attributes.hpp>
  10. # include <boost/python/object_items.hpp>
  11. # include <boost/python/object_slices.hpp>
  12. # include <boost/python/object_operators.hpp>
  13. # include <boost/python/converter/arg_to_python.hpp>
  14. namespace boost { namespace python {
  15. inline ssize_t len(object const& obj)
  16. {
  17. ssize_t result = PyObject_Length(obj.ptr());
  18. if (PyErr_Occurred()) throw_error_already_set();
  19. return result;
  20. }
  21. }} // namespace boost::python
  22. #endif // OBJECT_DWA2002612_HPP