|
Boost : |
From: me22 (me22.ca_at_[hidden])
Date: 2006-02-09 18:03:01
On 2/9/06, Johan Johansson <johanj_at_[hidden]> wrote:
> > while a pointer means that the method will be
> >taking ownership of that pointer.
> >
> Well, it's a possibility, but again not necessarily global law I think.
>
Well, it's obviously not a "global law".
But what does pass-by-pointer give over pass-by-reference? There's
the possibility of null, but I'd rather do optional arguments with
overloaded functions or, for complicated ones, with Boost.Parameter.
The only other difference is in ownership/lifetime management ( though
I'd rather make that more explicit with an std::auto_ptr or other
smart pointer anyways ). I basically don't see any other reason to
pass by pointer except for lifetime, which is irrelevant when it's
being used as an output parameter since there's no resource ownership
transfer.
~ Scott
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk