Opened 10 years ago
Closed 5 years ago
#7423 closed Bugs (fixed)
std::map::erase returns iterator in C++11 mode instead of void, should be handled properly
Reported by: | Owned by: | Kohei Takahashi | |
---|---|---|---|
Milestone: | Boost 1.65.0 | Component: | phoenix |
Version: | Boost 1.52.0 | Severity: | Problem |
Keywords: | Cc: |
Description
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.
Change History (2)
comment:1 by , 5 years ago
Owner: | changed from | to
---|
comment:2 by , 5 years ago
Milestone: | To Be Determined → Boost 1.65.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Fixed in https://github.com/boostorg/phoenix/pull/52