logo       

Re: Can't get a simple example with fstream to compile & link: msg#00183

python.c++

Subject: Re: Can't get a simple example with fstream to compile & link

I guess what I was trying to ask is: Why is a copy
constructor needed for everything?

For example if I want to open a member file object
within the constructor of the object I am wrapping and
close it within the destructor that seems good and
normal to me. However, without making it a pointer to
a file object I can't because the boost::python
library wants to copy it.

I don't understand why it would need to make a copy of
it. That's the part I'm trying to understand.

Thanks for your help.

--- Stefan Seefeld <seefeld@xxxxxxxxxxxx> wrote:
> Fast Bike wrote:
> > Opps, I messed up when cutting and pasting my
> example
> > out of a larger sample.
> >
> > The constructor shouldn't start to initialize
> > variables and should read:
> >
> > PythonWrapper(int id) { myid = id; };
>
> It's generally preferable to use the initializer
> list instead of doing
> assignment within the constructor body.
>
> Stefan
>
>
> _______________________________________________
> C++-sig mailing list
> C++-sig@xxxxxxxxxx
> http://mail.python.org/mailman/listinfo/c++-sig


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise