Boost logo

Boost :

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

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

> g()'s interface returns a reference and not a pointer. That is a clear
> indication that g()'s caller does not own the memory. By contrast, f()
> returns a pointer. The caller is not unreasonable in thinking ownership
> might be transferred, particularly if local conventions indicate as much.

I have a hard time imaging a useable code base which has a convention that
any time a pointer is returned one should assume that the memory must be
deleted by the caller. You couldn't even call something as simple as
strncat in such an environment, let alone most libraries with a C API.

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

Boost list run by bdawes at, gregod at, cpdaniel at, john at