File indexing completed on 2025-01-18 09:50:37
0001
0002
0003
0004
0005 #ifndef IMPLICIT_DWA2002326_HPP
0006 # define IMPLICIT_DWA2002326_HPP
0007
0008 # include <boost/python/converter/rvalue_from_python_data.hpp>
0009 # include <boost/python/converter/registrations.hpp>
0010 # include <boost/python/converter/registered.hpp>
0011
0012 # include <boost/python/extract.hpp>
0013
0014 namespace boost { namespace python { namespace converter {
0015
0016 template <class Source, class Target>
0017 struct implicit
0018 {
0019 static void* convertible(PyObject* obj)
0020 {
0021
0022
0023
0024
0025 return implicit_rvalue_convertible_from_python(obj, registered<Source>::converters)
0026 ? obj : 0;
0027 }
0028
0029 static void construct(PyObject* obj, rvalue_from_python_stage1_data* data)
0030 {
0031 void* storage = ((rvalue_from_python_storage<Target>*)data)->storage.bytes;
0032
0033 arg_from_python<Source> get_source(obj);
0034 bool convertible = get_source.convertible();
0035 BOOST_VERIFY(convertible);
0036
0037 new (storage) Target(get_source());
0038
0039
0040 data->convertible = storage;
0041 }
0042 };
0043
0044 }}}
0045
0046 #endif