implicit.hpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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 IMPLICIT_DWA2002325_HPP
  6. # define IMPLICIT_DWA2002325_HPP
  7. # include <boost/python/detail/prefix.hpp>
  8. # include <boost/type.hpp>
  9. # include <boost/python/converter/implicit.hpp>
  10. # include <boost/python/converter/registry.hpp>
  11. #ifndef BOOST_PYTHON_NO_PY_SIGNATURES
  12. # include <boost/python/converter/pytype_function.hpp>
  13. #endif
  14. # include <boost/python/type_id.hpp>
  15. namespace boost { namespace python {
  16. template <class Source, class Target>
  17. void implicitly_convertible(boost::type<Source>* = 0, boost::type<Target>* = 0)
  18. {
  19. typedef converter::implicit<Source,Target> functions;
  20. converter::registry::push_back(
  21. &functions::convertible
  22. , &functions::construct
  23. , type_id<Target>()
  24. #ifndef BOOST_PYTHON_NO_PY_SIGNATURES
  25. , &converter::expected_from_python_type_direct<Source>::get_pytype
  26. #endif
  27. );
  28. }
  29. }} // namespace boost::python
  30. #endif // IMPLICIT_DWA2002325_HPP