Boost logo

Boost :

Subject: Re: [boost] std::map::find() wrapper
From: Nevin Liber (nevin_at_[hidden])
Date: 2011-05-04 16:06:06


On 4 May 2011 13:24, Stewart, Robert <Robert.Stewart_at_[hidden]> wrote:

> An interface that returns a reference doesn't have the same problem.
> The caller must take the address and then delete it, which requires
> conscious misuse.
>

So:

delete foo;

is not conscious misuse, but

delete &foo;

is conscious misuse? Really? I would say both are conscious misuse, since
both require the user to do explicitly write code to do something.

No. That was my point. Boost cannot assume local conventions to give
> proper meaning to a function returning a raw pointer and so should avoid
> doing so.
>

I think Boost can assume that the user isn't going to do random things with
a pointer returned by an API. That being said, we are better off returning
a type which only allows desired operations.

-- 
 Nevin ":-)" Liber  <mailto:nevin_at_[hidden]>  (847) 691-1404

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk