Boost logo

Boost :

Subject: [boost] std::map::find() wrapper
From: Olaf van der Spek (ml_at_[hidden])
Date: 2011-04-20 09:54:50


Hi,

I've written a small wrapper for std::map::find() (and map-like
containers/ranges) that returns a pointer to the value if found (or
NULL if not found).

See https://svn.boost.org/trac/boost/ticket/5227

The advantage is that you don't need the container type name (for
::reference), you can initialize the pointer inside an if condition,
you don't have to compare against ::end() and you don't have to use
->second.
For containers of pointers to objects, the wrapper could do an
additional dereference.

Do you think this would be useful for inclusion in Boost?

Greetings,

Olaf


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