Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5227: find_ptr wrapper for map::find
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-07-02 17:24:10
#5227: find_ptr wrapper for map::find
-----------------------------------+----------------------------------------
Reporter: olafvdspek@⦠| Owner: no-maintainer
Type: Feature Requests | Status: new
Milestone: Boost 1.47.0 | Component: utility
Version: Boost 1.46.0 | Severity: Problem
Resolution: | Keywords:
-----------------------------------+----------------------------------------
Comment (by Olaf van der Spek <olafvdspek@â¦>):
To avoid issues with ptr_container, T::value_type::second_type should be
used instead of T::mapped_type
{{{
template <class T, class U>
typename T::value_type::second_type* find_ptr(T& c, U v)
{
typename T::iterator i = c.find(v);
return i == c.end() ? NULL : &i->second;
}
template <class T, class U>
const typename T::value_type::second_type* find_ptr(const T& c, U v)
{
typename T::const_iterator i = c.find(v);
return i == c.end() ? NULL : &i->second;
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5227#comment:6> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:09 UTC