Fix integer rollover that triggers clang ubsan when U is unsigned

This commit is contained in:
Gary Furnish
2017-06-05 18:15:33 -06:00
parent 5e3e5d4fe6
commit e0aaf744a5

View File

@@ -963,7 +963,8 @@ template
inline typename container_detail::disable_if_trivially_destructible<I, void>::type
destroy_alloc_n(Allocator &a, I f, U n)
{
while(n--){
while(n){
--n;
allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(f));
++f;
}