|
Boost Users : |
Subject: Re: [Boost-users] [python] Passing pointers as arguments without copying.
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-09-26 16:06:41
On Sat, Sep 26, 2009 at 2:38 AM, Germán Diago <germandiago_at_[hidden]> wrote:
>>I don't know about the whole boost::noncopyable, but if you dont want
>>to pass a copy of the class, doesn't a reference/pointer do th trick?
>
> I don't know how to do it.
>
> I mean, I try to expose the class
>
> class_ <MyClass2, boost::noncopyable>...;
>
> class_<MyClass, boost::noncopyable>("MyClass", ...).
> def(&MyClass::f, "f");
>
> The problem is that "f", exposed to python, takes an argument of type
> MyClass2 *.
>
> But MyClass2 * is noncopyable. So I cannot expose f that way because
> python will try to copy *myclass2 and it's noncopyable.
>
> How can I avoid that copying? I don't know how. I saw something with ptr(),
> but it was to take a function with parameters from python to c++, not
> the other way, which
> is what I'm trying.
If it takes MyClass2*, then it will pass the memory address to it, it
should not copy it...
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net