id summary reporter owner description type status milestone component version severity resolution keywords cc 1422 const_iterator does not equate to value_type (or const value_type) Bill Buklis Thorsten Ottosen "In ptr_map, const_iterator does not represent value_type. Given this map: typedef boost::ptr_map BOOSTMAP; BOOSTMAP::value_type equates to: boost::ptr_container_detail::ref_pair BOOSTMAP::iterator does return this, but const_iterator returns: boost::ptr_container_detail::ref_pair which is unlike std::map which represents const value_type for const_iterator. Since this is a different structure, it's incompatible with BOOSTMAP::value_type. The following code works using std::map: {{{ typedef std::map STDMAP; int sample = 5; STDMAP sm; sm.insert( STDMAP::value_type(10,&sample) ); STDMAP::iterator sfirst = sm.begin(); STDMAP::const_iterator scfirst = sm.begin(); STDMAP::value_type& svt = *sfirst; const STDMAP::value_type& scvt = *scfirst; }}} But, the same fails on the last line with boost::ptr_map {{{ typedef boost::ptr_map BOOSTMAP; BOOSTMAP bm; DWORD key = 10; bm.insert( key, new int(5) ); BOOSTMAP::iterator bfirst = bm.begin(); BOOSTMAP::const_iterator bcfirst = bm.begin(); BOOSTMAP::value_type& bvt = *bfirst; const BOOSTMAP::value_type& bcvt = *bcfirst; }}} " Bugs closed To Be Determined ptr_container Boost 1.34.1 Problem invalid ptr_map, ptr_container, const_iterator