|
Boost Users : |
Subject: [Boost-users] Compiling Boost 1.47 with GCC 4.6.1 and --std=c++0x
From: Travis Gockel (travis_at_[hidden])
Date: 2011-11-04 19:47:55
I'm building Boost 1.47.0 with GCC 4.6.1 and C++11 support enabled and get
the following two errors building the Signals library:
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:105:23: error: call of overloaded
erase(boost::signals::detail::named_slot_map::group_iterator&) is
ambiguous
libs/signals/src/named_slot_map.cpp:105:23: note: candidates are:
/usr/local/include/c++/4.6.1/bits/stl_map.h:613:7: note: std::map<_Key,
_Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare,
_Alloc>::erase(std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator) [with
_Key = boost::signals::detail::stored_group, _Tp =
std::list<boost::signals::detail::connection_slot_pair>, _Compare =
boost::function2<bool, boost::signals::detail::stored_group,
boost::signals::detail::stored_group>, _Alloc =
std::allocator<std::pair<const boost::signals::detail::stored_group,
std::list<boost::signals::detail::connection_slot_pair> > >, std::map<_Key,
_Tp, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const
boost::signals::detail::stored_group,
std::list<boost::signals::detail::connection_slot_pair> > >, std::map<_Key,
_Tp, _Compare, _Alloc>::const_iterator =
std::_Rb_tree_const_iterator<std::pair<const
boost::signals::detail::stored_group,
std::list<boost::signals::detail::connection_slot_pair> > >]
/usr/local/include/c++/4.6.1/bits/stl_map.h:643:7: note: std::map<_Key,
_Tp, _Compare, _Alloc>::size_type std::map<_Key, _Tp, _Compare,
_Alloc>::erase(const key_type&) [with _Key =
boost::signals::detail::stored_group, _Tp =
std::list<boost::signals::detail::connection_slot_pair>, _Compare =
boost::function2<bool, boost::signals::detail::stored_group,
boost::signals::detail::stored_group>, _Alloc =
std::allocator<std::pair<const boost::signals::detail::stored_group,
std::list<boost::signals::detail::connection_slot_pair> > >, std::map<_Key,
_Tp, _Compare, _Alloc>::size_type = long unsigned int, std::map<_Key, _Tp,
_Compare, _Alloc>::key_type = boost::signals::detail::stored_group]
libs/signals/src/named_slot_map.cpp: In member function void
boost::signals::detail::named_slot_map::remove_disconnected_slots():
libs/signals/src/named_slot_map.cpp:128:35: error: call of overloaded
erase(std::_Rb_tree_iterator<std::pair<const
boost::signals::detail::stored_group,
std::list<boost::signals::detail::connection_slot_pair> > >::_Self) is
ambiguous
libs/signals/src/named_slot_map.cpp:128:35: note: candidates are:
/usr/local/include/c++/4.6.1/bits/stl_map.h:613:7: note: std::map<_Key,
_Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare,
_Alloc>::erase(std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator) [with
_Key = boost::signals::detail::stored_group, _Tp =
std::list<boost::signals::detail::connection_slot_pair>, _Compare =
boost::function2<bool, boost::signals::detail::stored_group,
boost::signals::detail::stored_group>, _Alloc =
std::allocator<std::pair<const boost::signals::detail::stored_group,
std::list<boost::signals::detail::connection_slot_pair> > >, std::map<_Key,
_Tp, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const
boost::signals::detail::stored_group,
std::list<boost::signals::detail::connection_slot_pair> > >, std::map<_Key,
_Tp, _Compare, _Alloc>::const_iterator =
std::_Rb_tree_const_iterator<std::pair<const
boost::signals::detail::stored_group,
std::list<boost::signals::detail::connection_slot_pair> > >]
/usr/local/include/c++/4.6.1/bits/stl_map.h:643:7: note: std::map<_Key,
_Tp, _Compare, _Alloc>::size_type std::map<_Key, _Tp, _Compare,
_Alloc>::erase(const key_type&) [with _Key =
boost::signals::detail::stored_group, _Tp =
std::list<boost::signals::detail::connection_slot_pair>, _Compare =
boost::function2<bool, boost::signals::detail::stored_group,
boost::signals::detail::stored_group>, _Alloc =
std::allocator<std::pair<const boost::signals::detail::stored_group,
std::list<boost::signals::detail::connection_slot_pair> > >, std::map<_Key,
_Tp, _Compare, _Alloc>::size_type = long unsigned int, std::map<_Key, _Tp,
_Compare, _Alloc>::key_type = boost::signals::detail::stored_group]
WHOA BUDDY!
Anyway, if you look into this, it is because my STL implementation has
changed to the new definition for map::erase which takes a const_iterator.
As you can see, trying to erase with an iterator creates an ambiguous call
between the const_iterator and key_type.
I came up with two solutions: One was to explicitly cast to a
const_iterator and the other was to mark
stored_group::stored_group<T>(const T&) as explicit. Both work perfectly
fine for me, but I like the explicit constructor solution better. I
attached that change as a patch...feel free to use it if it doesn't break
anything (which it probably does).
-- Travis Gockel
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net