[C++-sig] accessing nontrivial types
Matthew Scouten (TT)
Matthew.Scouten at tradingtechnologies.com
Thu Feb 4 19:45:20 CET 2010
The stl containers are not handled by default. You will have to manually
expose it. You have a few options here:
1) the vector_indexing_suite might work for a std::list. Give it
a try.
2) Manually expose the function the you care about.
3) have a couple of get/set functions as a property that copies
your std::list to and from a bp::list.
-----Original Message-----
From:
cplusplus-sig-bounces+matthew.scouten=tradingtechnologies.com at python.org
[mailto:cplusplus-sig-bounces+matthew.scouten=tradingtechnologies.com at py
thon.org] On Behalf Of Anders Wallin
Sent: Thursday, February 04, 2010 12:23 PM
To: Development of Python/C++ integration
Subject: [C++-sig] accessing nontrivial types
Hello group,
simple types (int, float, etc.) seem to transfer without problem to
C++ and back to Python, but whenever I try returning something
nontrivial from C++ I get something like this:
>>> a = myclass.Myclass()
>>> print a.i
42
>>> print a.f
3.14159
>>> print a.ilist
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: No Python class registered for C++ class std::list<int,
std::allocator<int> >
The code for this example is here:
http://pastebin.com/m4c45a88
I tried looking in the documentation but was not able to understand
what to do about this error. Any examples out there?
thanks,
AW
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig at python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig
More information about the Cplusplus-sig
mailing list