Re: [Boost-bugs] [Boost C++ Libraries] #5991: find_ptr (find wrapper)

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5991: find_ptr (find wrapper)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-10-09 19:14:23


#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:
-------------------------------------------------------+--------------------
Changes (by joaquin):

  * status: new => closed
  * resolution: => wontfix

Comment:

 I don't think this is sufficiently useful as to be included in the general
 API of Boost.MultiIndex (for one, no container in STL or Boost does it.)
 In any case, you can roll your own find_ptr utility:
 {{{
 template<typename Container,typename Key>
 const typename Container::value_type*
 find_ptr(const Container&c,const Key& k)
 {
   auto i=c.find(k);
   return i==c.end()?0:&*i;
 }
 ...

 if(auto p=find_ptr(c,5)){...}
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5991#comment:1>
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