Re: [C++-sig] automatic conversion of tuple to vector

2010-05-25 Thread Michele De Stefano
Nathan, if you want to take a boost::numeric::ublas::vector instead of std::vector, you can use my library (mds-utils, the link is at the end of this e-mail), which already provides the proper converters. Bye, Michele 2010/5/25 Jim Bosch : > On 05/24/2010 03:00 PM, Nathan Cournia wrote: >> >> Ba

Re: [C++-sig] No to_python (by-value) converter found for C++ type

2010-05-25 Thread Roman Yakovenko
On Tue, May 25, 2010 at 9:58 AM, abhi.sri45 wrote: > > Hi, > >>mb = module_builder_t( ... ) >>mb.class_(...).noncopyable = False > > This does not works in my case. > > Example code is: > > enum CallStatus > { >        SUCCESS = 423, >        FAILURE = 764 > }; > > template > struct CallResult > {

Re: [C++-sig] How to wrap reference to abstract base class to get C++ polymorphism

2010-05-25 Thread Kun Hong
On 20/05/2010, at 11:03 PM, Kun Hong wrote: Hi, I have a maybe entry-level question. But it really troubled me for a while. I need to wrap a C++ library which has some factory method to return references to some abstract base classes. So the implementation is hidden. If I want a python equival

Re: [C++-sig] automatic conversion of tuple to vector

2010-05-25 Thread Jim Bosch
Hope I'm not thread-hijacking too much here, but this piqued my curiosity: On 05/25/2010 12:06 AM, Michele De Stefano wrote: Nathan, if you want to take a boost::numeric::ublas::vector instead of std::vector, you can use my library (mds-utils, the link is at the end of this e-mail), which alrea

Re: [C++-sig] automatic conversion of tuple to vector

2010-05-25 Thread Michele De Stefano
Jim, actually, this IS impossible, for a limit of Boost.Python. The explanation is into the FAQs of the Boost.Python documentation. Basically it is not possible to develop an l-value converter, so it's not possible to solve this problem. The author of Boost.Python explains that for solving this p

Re: [C++-sig] No to_python (by-value) converter found for C++ type

2010-05-25 Thread abhi.sri45
Hi, > In this case the class indeed noncopyable. I could not get this because, in my example program which I send earlier, there is a function CallResult getCallResult() { Simple si; return CallResult(SUCCESS, si); } Temporary object is created in return statement and hence it

Re: [C++-sig] How to expose to a python user defined type with to/from_python convertors?

2010-05-25 Thread X Wang
> How do I expose my C++ type to a user > defined python type? I think I could use boost python > class_<> wrapper to wrap around, but if I want to use > to_python/from_python convertors? > > Say I want to expose my C++ class(CA) to a python > type(PA): > > C++: > class CA > { >   public: >    

Re: [C++-sig] How to expose to a python user defined type with to/from_python convertors?

2010-05-25 Thread Michele De Stefano
There's a very good tutorial on writing from/to python converters. This tutorial was suggested to me by one of the members of this mailing list and I've found it very useful. The link is this one: http://misspent.wordpress.com/2009/09/27/how-to-write-boost-python-converters/ After reading this ve

Re: [C++-sig] Boost.Python Problem

2010-05-25 Thread Jim Bosch
On 05/18/2010 12:44 PM, alexandre monti wrote: object main_module((handle<>(borrowed(PyImport_AddModule("__main__"); object main_namespace = main_module.attr("__dict__"); What's the context? At least on my Ubuntu system, the following code: #include using namespace boost::python; BOOST