mirror of
https://github.com/boostorg/algorithm.git
synced 2025-07-06 09:16:33 +02:00
Fix bugs in copy_if; add basic tests. Refs #7400. Thanks to Hideaki Takei for the catch
[SVN r80617]
This commit is contained in:
@ -39,7 +39,7 @@ OutputIterator copy_if ( InputIterator first, InputIterator last, OutputIterator
|
|||||||
{
|
{
|
||||||
for ( ; first != last; ++first )
|
for ( ; first != last; ++first )
|
||||||
if (p(*first))
|
if (p(*first))
|
||||||
*result++ = first;
|
*result++ = *first;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -75,7 +75,7 @@ OutputIterator copy_while ( InputIterator first, InputIterator last,
|
|||||||
OutputIterator result, Predicate p )
|
OutputIterator result, Predicate p )
|
||||||
{
|
{
|
||||||
for ( ; first != last && p(*first); ++first )
|
for ( ; first != last && p(*first); ++first )
|
||||||
*result++ = first;
|
*result++ = *first;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ template<typename InputIterator, typename OutputIterator, typename Predicate>
|
|||||||
OutputIterator copy_until ( InputIterator first, InputIterator last, OutputIterator result, Predicate p )
|
OutputIterator copy_until ( InputIterator first, InputIterator last, OutputIterator result, Predicate p )
|
||||||
{
|
{
|
||||||
for ( ; first != last && !p(*first); ++first )
|
for ( ; first != last && !p(*first); ++first )
|
||||||
*result++ = first;
|
*result++ = *first;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user