|
Boost : |
Subject: Re: [boost] std::map::find() wrapper
From: Marsh Ray (marsh_at_[hidden])
Date: 2011-05-04 14:42:36
On 05/04/2011 01:12 PM, Olaf van der Spek wrote:
> On Wed, May 4, 2011 at 7:51 PM, Denis Shevchenko
> <for.dshevchenko_at_[hidden]> wrote:
>>
>> No, it's not dogma. Raw pointers are not the universal evil, but I never use
>> raw pointers because I *can* write my code without raw pointers. :-)
>
> That still doesn't tell me why that's better in this case.
Because it uses the C++ type system to restrict the number of possible
interpretations about the valid operations on the returned value, thus
communicating information that would otherwise go unspecified.
Sometimes this lets the compiler help spot problems with the program's
correctness. Even if not now, it can once in a while save your ass as
the program evolves over time.
- Marsh
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk