From 678183f8315444605957c6ba824b2355f29b06b4 Mon Sep 17 00:00:00 2001 From: Pavol Droba Date: Tue, 9 Mar 2004 17:58:59 +0000 Subject: [PATCH] fixed problem with a iterator running out of range (reported by gcc3.4 as an invalid condition even though the iterator has not been dereferenced) [SVN r22462] --- include/boost/algorithm/string/detail/finder.hpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/boost/algorithm/string/detail/finder.hpp b/include/boost/algorithm/string/detail/finder.hpp index 7f68de5..8be82f1 100644 --- a/include/boost/algorithm/string/detail/finder.hpp +++ b/include/boost/algorithm/string/detail/finder.hpp @@ -325,10 +325,14 @@ namespace boost { typedef ForwardIteratorT input_iterator_type; typedef iterator_range result_type; - input_iterator_type It=Begin+m_N; - if ( It >= End ) It=End; - - return result_type( Begin, It ); + if(std::distance(Begin,End) >= m_N) + { + return result_type(Begin,End); + } + else + { + return result_type(Begin,Begin+m_N); + } } private: