mirror of
https://github.com/boostorg/multi_index.git
synced 2025-05-09 23:14:04 +00:00
extended safe mode to deal with assignments of invalid iterators
[SVN r23904]
This commit is contained in:
parent
d571b05b22
commit
cd62da5ed2
@ -80,6 +80,7 @@ public:
|
||||
|
||||
index_iterator& operator=(const index_iterator& x)
|
||||
{
|
||||
BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(x);
|
||||
safe_super::operator=(x);
|
||||
node=x.node;
|
||||
return *this;
|
||||
@ -91,7 +92,6 @@ public:
|
||||
index_iterator(Node* node_):node(node_){}
|
||||
#endif
|
||||
|
||||
|
||||
const typename Node::value_type& operator*()const
|
||||
{
|
||||
BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(*this);
|
||||
|
@ -51,6 +51,12 @@ void test_safe_mode()
|
||||
employee_set_as_inserted& i=get<as_inserted>(es);
|
||||
es.insert(employee(0,"Joe",31));
|
||||
|
||||
TRY_SAFE_MODE
|
||||
employee_set::iterator it;
|
||||
employee_set::iterator it2=es.begin();
|
||||
it2=it;
|
||||
CATCH_SAFE_MODE(safe_mode::invalid_iterator)
|
||||
|
||||
TRY_SAFE_MODE
|
||||
employee_set::iterator it;
|
||||
employee e=*it;
|
||||
@ -131,6 +137,16 @@ void test_safe_mode()
|
||||
employee e=*it;
|
||||
CATCH_SAFE_MODE(safe_mode::invalid_iterator)
|
||||
|
||||
TRY_SAFE_MODE
|
||||
employee_set::iterator it;
|
||||
{
|
||||
employee_set es3;
|
||||
it=es3.insert(employee(0,"Joe",31)).first;
|
||||
}
|
||||
employee_set::iterator it2;
|
||||
it2=it;
|
||||
CATCH_SAFE_MODE(safe_mode::invalid_iterator)
|
||||
|
||||
TRY_SAFE_MODE
|
||||
employee_set es3(es);
|
||||
employee_set es4;
|
||||
|
Loading…
x
Reference in New Issue
Block a user