Exporting references into boost::python
A newbie question regarding boost::python.
I need to make a templatized function that returns a
boost::python::object containing a reference to an object I already
have. Basically:
template<class T>
object convertToPython (T &obj) {
return object (obj)
}
All classes I pass through T are already wrapped (they are also not
copy-constructible). I tried with the code found at python.orgs wiki:
template<class T> T& identity(T& x) { return x; }
template<class T> object get_object_reference (T& x) {
object f = make_function
(&identity<T>, return_value_policy
Nicholas Francis
A newbie question regarding boost::python.
Nicholas, Try asking on the Python C++-sig: http://www.python.org/sigs/c++-sig/ -Dave -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (2)
-
David Abrahams
-
Nicholas Francis