From 8dee10d3c18e8cba37a45cd84b8f81f2907a229b Mon Sep 17 00:00:00 2001 From: Marcel Raad Date: Mon, 2 Mar 2015 18:39:37 +0100 Subject: [PATCH] Fix ptr_list compile break https://github.com/boostorg/utility/commit/651a869d4f9479dd3dfdd0293305a60b8c8d0e1c broke the ptr_list regression tests as boost::next now uses operator+= if available instead of std::advance, which doesn't work for list iterators. --- include/boost/ptr_container/ptr_sequence_adapter.hpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/include/boost/ptr_container/ptr_sequence_adapter.hpp b/include/boost/ptr_container/ptr_sequence_adapter.hpp index ad8542ed..5270255a 100644 --- a/include/boost/ptr_container/ptr_sequence_adapter.hpp +++ b/include/boost/ptr_container/ptr_sequence_adapter.hpp @@ -22,6 +22,7 @@ #include #include #include +#include namespace boost @@ -513,7 +514,9 @@ namespace ptr_container_detail size_type old_size = this->size(); if( old_size > size ) { - this->erase( boost::next( this->begin(), size ), this->end() ); + iterator from = this->begin(); + std::advance( from, size ); + this->erase( from, this->end() ); } else if( size > old_size ) { @@ -530,7 +533,9 @@ namespace ptr_container_detail size_type old_size = this->size(); if( old_size > size ) { - this->erase( boost::next( this->begin(), size ), this->end() ); + iterator from = this->begin(); + std::advance( from, size ); + this->erase( from, this->end() ); } else if( size > old_size ) { @@ -546,8 +551,9 @@ namespace ptr_container_detail size_type old_size = this->size(); if( old_size > size ) { - this->erase( this->begin(), - boost::next( this->begin(), old_size - size ) ); + iterator to = this->begin(); + std::advance( to, old_size - size ); + this->erase( this->begin(), to ); } else if( size > old_size ) { @@ -564,8 +570,9 @@ namespace ptr_container_detail size_type old_size = this->size(); if( old_size > size ) { - this->erase( this->begin(), - boost::next( this->begin(), old_size - size ) ); + iterator to = this->begin(); + std::advance( to, old_size - size ); + this->erase( this->begin(), to ); } else if( size > old_size ) {