[C++-sig] Non-const reference arguments and from_python conversions

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Tue May 20 20:50:06 CEST 2008


> Does this mean the argument MUST be passed by const-reference or by
> value (i.e. it can't be a non-const reference or a pointer)?

Yes. -- A few years ago we had a contract with David to implement
support for "converters with write-back", but it turned out to be
too difficult.

In theory you can use indirection of some sort to get around the problem
(e.g. make a proxy object holding a reference to the object you actually want
to pass, pass the proxy by value). However, in most cases this will
probably impose unacceptable restrictions on the interface.

Ralf



More information about the Cplusplus-sig mailing list