wrapper.hpp 1023 B

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright David Abrahams 2004. Distributed under the Boost
  2. // Software License, Version 1.0. (See accompanying
  3. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  4. #ifndef WRAPPER_DWA2004720_HPP
  5. # define WRAPPER_DWA2004720_HPP
  6. # include <boost/python/detail/wrapper_base.hpp>
  7. # include <boost/python/override.hpp>
  8. # include <boost/python/converter/registered.hpp>
  9. # include <boost/python/detail/sfinae.hpp>
  10. namespace boost { namespace python {
  11. template <class T>
  12. class wrapper : public detail::wrapper_base
  13. {
  14. public:
  15. // Do not touch this implementation detail!
  16. typedef T _wrapper_wrapped_type_;
  17. protected:
  18. override get_override(char const* name) const
  19. {
  20. typedef detail::wrapper_base base;
  21. converter::registration const& r
  22. = converter::registered<T>::converters;
  23. PyTypeObject* type = r.get_class_object();
  24. return this->base::get_override(name, type);
  25. }
  26. };
  27. }} // namespace boost::python
  28. #endif // WRAPPER_DWA2004720_HPP