Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Function template iter_split

boost::algorithm::iter_split — Split find algorithm.


// In header: <boost/algorithm/string/iter_find.hpp>

template<typename SequenceSequenceT, typename RangeT, typename FinderT> 
  SequenceSequenceT & 
  iter_split(SequenceSequenceT & Result, RangeT & Input, FinderT Finder);


This algorithm executes a given finder in iteration on the input, until the end of input is reached, or no match is found. Iteration is done using built-in find_iterator, so the real searching is performed only when needed. Each match is used as a separator of segments. These segments are then returned in the result.

[Note] Note

Prior content of the result will be overwritten.



A finder object used for searching


A container which will be searched.


A 'container container' to container the result of search. Both outer and inner container must have constructor taking a pair of iterators as an argument. Typical type of the result is std::vector<boost::iterator_range<iterator>> (each element of such a vector will container a range delimiting a match).


A reference the result