Update of /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/detail
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14588/boost/thread_safe_signals/detail
Modified Files:
slot_groups.hpp
Log Message:
Fixed some problems with slot ordering due to my misunderstanding
of how std::map::insert() handles the case of an already existing
key.
Index: slot_groups.hpp
===================================================================
RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/thread_safe_signals/detail/slot_groups.hpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- slot_groups.hpp 28 Feb 2007 17:08:48 -0000 1.13
+++ slot_groups.hpp 1 Mar 2007 18:57:35 -0000 1.14
@@ -16,7 +16,6 @@
#include <boost/thread_safe_signals/connection.hpp>
#include <boost/optional.hpp>
-#include <cassert>
#include <list>
#include <map>
#include <utility>
@@ -108,7 +107,7 @@
{
map_iterator map_it;
if(key.first == back_ungrouped_slots)
- {
+ {// optimization
map_it = _group_map.end();
}else
{
@@ -129,19 +128,18 @@
}
iterator erase(const group_key_type &key, const iterator &it)
{
- assert(it != _list.end());
+ BOOST_ASSERT(it != _list.end());
map_iterator map_it = _group_map.lower_bound(key);
- assert(map_it != _group_map.end());
- assert(weakly_equivalent(map_it->first, key));
+ BOOST_ASSERT(map_it != _group_map.end());
+ BOOST_ASSERT(weakly_equivalent(map_it->first, key));
if(map_it->second == it)
{
iterator next = it;
++next;
// if next is in same group
- if(next != _list.end() && next != upper_bound(key))
+ if(next != upper_bound(key))
{
- // also erases old entry
- _group_map.insert(map_it, typename map_type::value_type(key, next));
+ _group_map[key] = next;
}else
{
_group_map.erase(map_it);
@@ -173,7 +171,7 @@
if(lower_bound_it == _group_map.end() ||
weakly_equivalent(lower_bound_it->first, key) == false)
{
- _group_map.insert(typename map_type::value_type(key, new_it));
+ _group_map[key] = new_it;
}
}
iterator get_list_iterator(const map_iterator &map_it)
|