Boost C++ Libraries

...one 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 for the latest Boost documentation.
PrevUpHomeNext

Function template find_head

boost::algorithm::find_head — Find head algorithm.

Synopsis

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


template<typename RangeT> 
  iterator_range< typename range_iterator< RangeT >::type > 
  find_head(RangeT & Input, int N);

Description

Get the head of the input. Head is a prefix of the string of the given size. If the input is shorter then required, whole input is considered to be the head.

[Note] Note

This function provides the strong exception-safety guarantee

Parameters:

Input

An input string

N

Length of the head For N>=0, at most N characters are extracted. For N<0, at most size(Input)-|N| characters are extracted.

Returns:

An iterator_range delimiting the match. Returned iterator is either Range1T::iterator or Range1T::const_iterator, depending on the constness of the input parameter.


PrevUpHomeNext