2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-26 06:42:27 +00:00

more implicit conversion work

[SVN r13282]
This commit is contained in:
Dave Abrahams
2002-03-26 17:16:33 +00:00
parent ac34e0e108
commit 576269dae9
8 changed files with 73 additions and 6 deletions

View File

@@ -37,7 +37,7 @@ struct implicit
registration->construct(obj, &intermediate_data.stage1);
void* storage = ((rvalue_base_data<Target>*)data)->storage.bytes;
new (storage) Target(*(Source*)intermediate_data.storage.bytes);
new (storage) Target(*static_cast<Source*>(intermediate_data.stage1.convertible));
// record successful construction
data->convertible = storage;

View File

@@ -37,6 +37,14 @@ namespace registry
, undecorated_type_id_t
);
// Insert an rvalue from_python converter at the tail of the
// chain. Used for implicit conversions
BOOST_PYTHON_DECL void push_back(
void* (*convertible)(PyObject*)
, constructor_function
, undecorated_type_id_t
);
BOOST_PYTHON_DECL PyTypeObject*& class_object(undecorated_type_id_t key);
}

View File

@@ -17,7 +17,7 @@ void implicitly_convertible(boost::type<Source>* = 0, boost::type<Target>* = 0)
{
typedef converter::implicit<Source,Target> functions;
converter::registry::insert(
converter::registry::push_back(
&functions::convertible
, &functions::construct
, converter::undecorated_type_id<Target>());