[Boost-bugs] [Boost C++ Libraries] #4107: ptr_map::mapped_type incorrect

Subject: [Boost-bugs] [Boost C++ Libraries] #4107: ptr_map::mapped_type incorrect
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-04-16 10:48:44


#4107: ptr_map::mapped_type incorrect
----------------------------------+-----------------------------------------
 Reporter: olafvdspek@… | Owner: nesotto
     Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: ptr_container
  Version: Boost 1.42.0 | Severity: Problem
 Keywords: |
----------------------------------+-----------------------------------------
 ptr_map::mapped_type seems incorrect. It's int* instead of int.

 {{{
 #include <boost/ptr_container/ptr_map.hpp>
 #include <map>

 template <class T, class U>
 typename T::mapped_type* find_ptr(T& c, U v)
 {
         typename T::iterator i = c.find(v);
         return i == c.end() ? NULL : &i->second;
 }

 int main()
 {
         typedef boost::ptr_map<char, int> c1_t;
         std::map<char, int> c0;
         c1_t c1;
         int* p0 = find_ptr(c0, 'x');
         int* p1 = find_ptr(c1, 'x');
         return 0;
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4107>
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:02 UTC