[Boost-bugs] [Boost C++ Libraries] #7423: std::map::erase returns iterator in C++11 mode instead of void, should be handled properly

Subject: [Boost-bugs] [Boost C++ Libraries] #7423: std::map::erase returns iterator in C++11 mode instead of void, should be handled properly
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-09-26 09:56:38


#7423: std::map::erase returns iterator in C++11 mode instead of void, should be
handled properly
----------------------------------------------------+-----------------------
 Reporter: Andrei Elovikov <a.elovikov@…> | Owner: theller
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: phoenix
  Version: Boost 1.52.0 | Severity: Problem
 Keywords: |
----------------------------------------------------+-----------------------
 The issue is with the following code:
 boost/phoenix/stl/container.hpp, line 284

 {{{
         namespace result_of
         {
             template <typename C, typename Arg1, typename Arg2 =
 mpl::void_>
             struct erase
             {
                 // BOOST_MSVC #if branch here in map_erase_result non-
                 // standard behavior. The return type should be void but
                 // VC7.1 prefers to return iterator_of<C>. As a result,
                 // VC7.1 complains of error C2562:
                 // boost::phoenix::stl::erase::operator() 'void' function
                 // returning a value. Oh well... :*

                 typedef
                     boost::mpl::eval_if_c<
                         boost::is_same<
                             typename remove_reference<Arg1>::type
                           , typename iterator_of<C>::type
>::value
 #if defined(BOOST_MSVC)// && (BOOST_MSVC <= 1500)
                       , iterator_of<C>
 #else
                       , boost::mpl::identity<void>
 #endif
                       , size_type_of<C>
>
                 map_erase_result;

                 typedef typename
                     boost::mpl::eval_if_c<
                         has_mapped_type<C>::value
                       , map_erase_result
                       , iterator_of<C>
>::type
                 type;
             };
         }
 }}}

 It seems that MSVC's behaviour becomes the standard one with C++11.

 Also the current check seems to be done incorrectly because Intel Compiler
 uses MSVC's stl library on Windows, so checking for _MSC_VER will be more
 appropriate, I think.

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