Boost logo

Boost :

Subject: [boost] [signals] Compiler error
From: Claas H. Köhler (claas.koehler_at_[hidden])
Date: 2011-11-18 06:57:05


Hi everybody!

When compiling boost 1.48.0 using gcc-4.6 and the "--std=c+0x" option, I
get the following error message:

libs/signals/src/named_slot_map.cpp: In member function ‘void
boost::signals::detail::named_slot_map::disconnect(const
boost::signals::detail::stored_group&)’:
libs/signals/src/named_slot_map.cpp:99:48: error: conversion from
‘std::list<boost::signals::detail::connection_slot_pair>::const_iterator
{aka
std::_List_const_iterator<boost::signals::detail::connection_slot_pair>}’ to
non-scalar type ‘boost::signals::detail::slot_pair_iterator {aka
std::_List_iterator<boost::signals::detail::connection_slot_pair>}’
requested

The reason seems to be that std::map's erase function expects a
std::map::iterator in the old standard (according to cplusplus.com),
while c++11 seemingly requires a std::map::const_iterator as argument
(see section 23.4.4.1).

Thus replacing line 105
  OLD groups.erase(group);
  NEW groups.erase( static_cast<const_group_iterator>(group) );

and line 128
OLD if (empty(g)) groups.erase(g++);
NEW if (empty(g)) groups.erase( static_cast<const_group_iterator>(g++);

solves the problem for me.

Is it intended to have all boost libraries conforming with C++11?

Regards
Claas


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk