Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67423 - trunk/boost/range/adaptor
From: neil_at_[hidden]
Date: 2010-12-22 19:56:05


Author: neilgroves
Date: 2010-12-22 19:56:04 EST (Wed, 22 Dec 2010)
New Revision: 67423
URL: http://svn.boost.org/trac/boost/changeset/67423

Log:
[boost][range] - Resolution of Trac item 4905 - Implementation of boost::range::map_keys should use boost::range_reference
Text files modified:
   trunk/boost/range/adaptor/map.hpp | 21 ++++++++++-----------
   1 files changed, 10 insertions(+), 11 deletions(-)

Modified: trunk/boost/range/adaptor/map.hpp
==============================================================================
--- trunk/boost/range/adaptor/map.hpp (original)
+++ trunk/boost/range/adaptor/map.hpp 2010-12-22 19:56:04 EST (Wed, 22 Dec 2010)
@@ -14,6 +14,7 @@
 #include <boost/range/adaptor/transformed.hpp>
 #include <boost/range/iterator_range.hpp>
 #include <boost/range/value_type.hpp>
+#include <boost/range/reference.hpp>
 
 namespace boost
 {
@@ -25,11 +26,10 @@
         template< class Map >
         struct select_first
         {
- typedef BOOST_DEDUCED_TYPENAME range_value<Map>::type pair_t;
- typedef const BOOST_DEDUCED_TYPENAME pair_t::first_type&
- result_type;
+ typedef BOOST_DEDUCED_TYPENAME range_reference<const Map>::type argument_type;
+ typedef const BOOST_DEDUCED_TYPENAME range_value<const Map>::type::first_type& result_type;
 
- result_type operator()( const pair_t& r ) const
+ result_type operator()( argument_type r ) const
             {
                 return r.first;
             }
@@ -38,10 +38,10 @@
         template< class Map >
         struct select_second_mutable
         {
- typedef BOOST_DEDUCED_TYPENAME range_value<Map>::type pair_t;
- typedef BOOST_DEDUCED_TYPENAME pair_t::second_type& result_type;
+ typedef BOOST_DEDUCED_TYPENAME range_reference<Map>::type argument_type;
+ typedef BOOST_DEDUCED_TYPENAME range_value<Map>::type::second_type& result_type;
 
- result_type operator()( pair_t& r ) const
+ result_type operator()( argument_type r ) const
             {
                 return r.second;
             }
@@ -50,11 +50,10 @@
         template< class Map >
         struct select_second_const
         {
- typedef BOOST_DEDUCED_TYPENAME range_value<Map>::type pair_t;
- typedef const BOOST_DEDUCED_TYPENAME pair_t::second_type&
- result_type;
+ typedef BOOST_DEDUCED_TYPENAME range_reference<const Map>::type argument_type;
+ typedef const BOOST_DEDUCED_TYPENAME range_value<const Map>::type::second_type& result_type;
 
- result_type operator()( const pair_t& r ) const
+ result_type operator()( argument_type r ) const
             {
                 return r.second;
             }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk