|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-08-27 07:30:10
From: "Peter Dimov" <pdimov_at_[hidden]>
> What is the "best" way to pass an std::auto_ptr to a function?
>
> (I use std::auto_ptr as a shorthand for "an user-defined type with
> std::auto_ptr-like destructive copy semantics.")
>
> Obviously there is no best way since the two alternatives have radically
> different meanings.
>
> This doesn't affect functional.hpp::mem_fun since std::mem_fun(pmf) always
> takes its arguments by const reference, and hence, doesn't support
by-value
> auto_ptr arguments. The only thing to watch out for is to not turn a
> by-const-ref auto_ptr to a by-value auto_ptr. ;-)
Oops. This is not true. (What was I thinking?) (const_)mem_fun1_t<S, T, A>
take A by value. So this issue does affect functional.hpp; its mem_fun
doesn't meet the requirements for std::mem_fun.
I'm confused. Is this a bug in, or a feature of, functional.hpp?
-- Peter Dimov Multi Media Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk