Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5991: find_ptr (find wrapper)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-11-04 07:37:07
#5991: find_ptr (find wrapper)
-------------------------------------------------------+--------------------
Reporter: Olaf van der Spek <olafvdspek@â¦> | Owner: joaquin
Type: Feature Requests | Status: closed
Milestone: To Be Determined | Component: multi_index
Version: Boost 1.47.0 | Severity: Problem
Resolution: wontfix | Keywords:
-------------------------------------------------------+--------------------
Comment (by joaquin):
Replying to [comment:7 Olaf van der Spek <olafvdspek@â¦>]:
> Replying to [comment:6 joaquin]:
> > Why a pointer to second?
>
> Because the key is known already.
>
> > This is not consistent with the semantics of std::map, which returns
an iterator to the whole element (the key-value pair), not the value
alone.
>
> std::map doesn't have find_ptr().
Of course, but it has find(), which I understand you're copying semantics
from, except that you return a pointer (null if no element was found)
rather than an iterator (pointing to end if no element was found.)
>
> > > IMO the wrapper is useful every time you use a map like container.
> >
> > In either case, find_ptr can be provided as an (overloaded) function,
no need to have as a built-in member function. Thus my reluctance to
address your request.
>
> Can it? I can't (easily) select another overload for containers (like
multi_index) that don't have a pair value_type.
multi_index_containers don't sport a notion of second_type. But you can
use the same wrapper as you're currently doing with std::set. Remember
this conversarion began with your request for a member function returning
a value_type* (not a pointer to the second part of the value.)
What problems are you having with defining an overload for
multi_index_containers?
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5991#comment:9> 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:07 UTC