mirror of
https://github.com/boostorg/intrusive.git
synced 2025-05-09 23:03:56 +00:00
Removed undefined behaviour when iterating backwards when using pointers.
This commit is contained in:
parent
5a7892a859
commit
ef8e57ae1b
@ -76,11 +76,11 @@ int main()
|
||||
|
||||
//Now test lists
|
||||
List::const_iterator list_it (my_list.cbegin());
|
||||
identifier_t *it_val(&ids[NumElements-1]), *it_rbeg_val(&ids[0]-1);
|
||||
identifier_t *it_val(&ids[NumElements]), *it_rbeg_val(&ids[0]);
|
||||
|
||||
//Test the objects inserted in the base hook list
|
||||
for(; it_val != it_rbeg_val; --it_val, ++list_it)
|
||||
if(&*list_it != &*it_val) return 1;
|
||||
if(&*list_it != &it_val[-1]) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -142,14 +142,14 @@ int main()
|
||||
List::const_iterator list_it (my_list.cbegin());
|
||||
Slist::const_iterator slist_it(my_slist.cbegin());
|
||||
Set::const_reverse_iterator set_rit(my_set.crbegin());
|
||||
MyClass *it_val(&values[NumElements-1]), *it_rbeg_val(&values[0]-1);
|
||||
MyClass *it_val(&values[NumElements]), *it_rbeg_val(&values[0]);
|
||||
|
||||
//Test the objects inserted in the base hook list
|
||||
for(; it_val != it_rbeg_val; --it_val, ++list_it, ++slist_it, ++set_rit){
|
||||
if(&*list_it != &*it_val) return 1;
|
||||
if(&*slist_it != &*it_val) return 1;
|
||||
if(&*set_rit != &*it_val) return 1;
|
||||
if(my_uset.find(*it_val) == my_uset.cend()) return 1;
|
||||
if(&*list_it != &it_val[-1]) return 1;
|
||||
if(&*slist_it != &it_val[-1]) return 1;
|
||||
if(&*set_rit != &it_val[-1]) return 1;
|
||||
if(my_uset.find(it_val[-1]) == my_uset.cend()) return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user