Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Reference

Header <boost/algorithm/string.hpp>
Header <boost/algorithm/string/case_conv.hpp>
Header <boost/algorithm/string/classification.hpp>
Header <boost/algorithm/string/compare.hpp>
Header <boost/algorithm/string/concept.hpp>
Header <boost/algorithm/string/constants.hpp>
Header <boost/algorithm/string/erase.hpp>
Header <boost/algorithm/string/find.hpp>
Header <boost/algorithm/string/find_format.hpp>
Header <boost/algorithm/string/find_iterator.hpp>
Header <boost/algorithm/string/finder.hpp>
Header <boost/algorithm/string/formatter.hpp>
Header <boost/algorithm/string/iter_find.hpp>
Header <boost/algorithm/string/join.hpp>
Header <boost/algorithm/string/predicate.hpp>
Header <boost/algorithm/string/regex.hpp>
Header <boost/algorithm/string/regex_find_format.hpp>
Header <boost/algorithm/string/replace.hpp>
Header <boost/algorithm/string/sequence_traits.hpp>
Header <boost/algorithm/string/split.hpp>
Header <boost/algorithm/string/std_containers_traits.hpp>
Header <boost/algorithm/string/trim.hpp>
Header <boost/algorithm/string/trim_all.hpp>
Header <boost/algorithm/string_regex.hpp>

Cumulative include for string_algo library

Defines sequence case-conversion algorithms. Algorithms convert each element in the input sequence to the desired case using provided locales.

namespace boost {
  namespace algorithm {
    template<typename OutputIteratorT, typename RangeT> 
      OutputIteratorT 
      to_lower_copy(OutputIteratorT, const RangeT &, 
                    const std::locale & = std::locale());
    template<typename SequenceT> 
      SequenceT to_lower_copy(const SequenceT &, 
                              const std::locale & = std::locale());
    template<typename WritableRangeT> 
      void to_lower(WritableRangeT &, const std::locale & = std::locale());
    template<typename OutputIteratorT, typename RangeT> 
      OutputIteratorT 
      to_upper_copy(OutputIteratorT, const RangeT &, 
                    const std::locale & = std::locale());
    template<typename SequenceT> 
      SequenceT to_upper_copy(const SequenceT &, 
                              const std::locale & = std::locale());
    template<typename WritableRangeT> 
      void to_upper(WritableRangeT &, const std::locale & = std::locale());
  }
}

Classification predicates are included in the library to give some more convenience when using algorithms like trim() and all(). They wrap functionality of STL classification functions ( e.g. std::isspace() ) into generic functors.

namespace boost {
  namespace algorithm {
    unspecified is_classified(std::ctype_base::mask, 
                              const std::locale & = std::locale());
    unspecified is_space(const std::locale & = std::locale());
    unspecified is_alnum(const std::locale & = std::locale());
    unspecified is_alpha(const std::locale & = std::locale());
    unspecified is_cntrl(const std::locale & = std::locale());
    unspecified is_digit(const std::locale & = std::locale());
    unspecified is_graph(const std::locale & = std::locale());
    unspecified is_lower(const std::locale & = std::locale());
    unspecified is_print(const std::locale & = std::locale());
    unspecified is_punct(const std::locale & = std::locale());
    unspecified is_upper(const std::locale & = std::locale());
    unspecified is_xdigit(const std::locale & = std::locale());
    template<typename RangeT> unspecified is_any_of(const RangeT &);
    template<typename CharT> unspecified is_from_range(CharT, CharT);
    template<typename Pred1T, typename Pred2T> 
      unspecified operator&&(const predicate_facade< Pred1T > &, 
                             const predicate_facade< Pred2T > &);
    template<typename Pred1T, typename Pred2T> 
      unspecified operator||(const predicate_facade< Pred1T > &, 
                             const predicate_facade< Pred2T > &);
    template<typename PredT> 
      unspecified operator!(const predicate_facade< PredT > &);
  }
}

Defines element comparison predicates. Many algorithms in this library can take an additional argument with a predicate used to compare elements. This makes it possible, for instance, to have case insensitive versions of the algorithms.

namespace boost {
  namespace algorithm {
    struct is_equal;
    struct is_iequal;
    struct is_less;
    struct is_iless;
    struct is_not_greater;
    struct is_not_igreater;
  }
}

Defines concepts used in string_algo library

namespace boost {
  namespace algorithm {
    template<typename FinderT, typename IteratorT> struct FinderConcept;
    template<typename FormatterT, typename FinderT, typename IteratorT> 
      struct FormatterConcept;
  }
}
namespace boost {
  namespace algorithm {
    enum token_compress_mode_type;
  }
}

Defines various erase algorithms. Each algorithm removes part(s) of the input according to a searching criteria.

namespace boost {
  namespace algorithm {
    template<typename OutputIteratorT, typename RangeT> 
      OutputIteratorT 
      erase_range_copy(OutputIteratorT, const RangeT &, 
                       const iterator_range< typename range_const_iterator< RangeT >::type > &);
    template<typename SequenceT> 
      SequenceT erase_range_copy(const SequenceT &, 
                                 const iterator_range< typename range_const_iterator< SequenceT >::type > &);
    template<typename SequenceT> 
      void erase_range(SequenceT &, 
                       const iterator_range< typename range_iterator< SequenceT >::type > &);
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
      OutputIteratorT 
      erase_first_copy(OutputIteratorT, const Range1T &, const Range2T &);
    template<typename SequenceT, typename RangeT> 
      SequenceT erase_first_copy(const SequenceT &, const RangeT &);
    template<typename SequenceT, typename RangeT> 
      void erase_first(SequenceT &, const RangeT &);
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
      OutputIteratorT 
      ierase_first_copy(OutputIteratorT, const Range1T &, const Range2T &, 
                        const std::locale & = std::locale());
    template<typename SequenceT, typename RangeT> 
      SequenceT ierase_first_copy(const SequenceT &, const RangeT &, 
                                  const std::locale & = std::locale());
    template<typename SequenceT, typename RangeT> 
      void ierase_first(SequenceT &, const RangeT &, 
                        const std::locale & = std::locale());
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
      OutputIteratorT 
      erase_last_copy(OutputIteratorT, const Range1T &, const Range2T &);
    template<typename SequenceT, typename RangeT> 
      SequenceT erase_last_copy(const SequenceT &, const RangeT &);
    template<typename SequenceT, typename RangeT> 
      void erase_last(SequenceT &, const RangeT &);
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
      OutputIteratorT 
      ierase_last_copy(OutputIteratorT, const Range1T &, const Range2T &, 
                       const std::locale & = std::locale());
    template<typename SequenceT, typename RangeT> 
      SequenceT ierase_last_copy(const SequenceT &, const RangeT &, 
                                 const std::locale & = std::locale());
    template<typename SequenceT, typename RangeT> 
      void ierase_last(SequenceT &, const RangeT &, 
                       const std::locale & = std::locale());
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
      OutputIteratorT 
      erase_nth_copy(OutputIteratorT, const Range1T &, const Range2T &, int);
    template<typename SequenceT, typename RangeT> 
      SequenceT erase_nth_copy(const SequenceT &, const RangeT &, int);
    template<typename SequenceT, typename RangeT> 
      void erase_nth(SequenceT &, const RangeT &, int);
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
      OutputIteratorT 
      ierase_nth_copy(OutputIteratorT, const Range1T &, const Range2T &, int, 
                      const std::locale & = std::locale());
    template<typename SequenceT, typename RangeT> 
      SequenceT ierase_nth_copy(const SequenceT &, const RangeT &, int, 
                                const std::locale & = std::locale());
    template<typename SequenceT, typename RangeT> 
      void ierase_nth(SequenceT &, const RangeT &, int, 
                      const std::locale & = std::locale());
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
      OutputIteratorT 
      erase_all_copy(OutputIteratorT, const Range1T &, const Range2T &);
    template<typename SequenceT, typename RangeT> 
      SequenceT erase_all_copy(const SequenceT &, const RangeT &);
    template<typename SequenceT, typename RangeT> 
      void erase_all(SequenceT &, const RangeT &);
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
      OutputIteratorT 
      ierase_all_copy(OutputIteratorT, const Range1T &, const Range2T &, 
                      const std::locale & = std::locale());
    template<typename SequenceT, typename RangeT> 
      SequenceT ierase_all_copy(const SequenceT &, const RangeT &, 
                                const std::locale & = std::locale());
    template<typename SequenceT, typename RangeT> 
      void ierase_all(SequenceT &, const RangeT &, 
                      const std::locale & = std::locale());
    template<typename OutputIteratorT, typename RangeT> 
      OutputIteratorT erase_head_copy(OutputIteratorT, const RangeT &, int);
    template<typename SequenceT> 
      SequenceT erase_head_copy(const SequenceT &, int);
    template<typename SequenceT> void erase_head(SequenceT &, int);
    template<typename OutputIteratorT, typename RangeT> 
      OutputIteratorT erase_tail_copy(OutputIteratorT, const RangeT &, int);
    template<typename SequenceT> 
      SequenceT erase_tail_copy(const SequenceT &, int);
    template<typename SequenceT> void erase_tail(SequenceT &, int);
  }
}

Defines a set of find algorithms. The algorithms are searching for a substring of the input. The result is given as an iterator_range delimiting the substring.

namespace boost {
  namespace algorithm {
    template<typename RangeT, typename FinderT> 
      iterator_range< typename range_iterator< RangeT >::type > 
      find(RangeT &, const FinderT &);
    template<typename Range1T, typename Range2T> 
      iterator_range< typename range_iterator< Range1T >::type > 
      find_first(Range1T &, const Range2T &);
    template<typename Range1T, typename Range2T> 
      iterator_range< typename range_iterator< Range1T >::type > 
      ifind_first(Range1T &, const Range2T &, 
                  const std::locale & = std::locale());
    template<typename Range1T, typename Range2T> 
      iterator_range< typename range_iterator< Range1T >::type > 
      find_last(Range1T &, const Range2T &);
    template<typename Range1T, typename Range2T> 
      iterator_range< typename range_iterator< Range1T >::type > 
      ifind_last(Range1T &, const Range2T &, 
                 const std::locale & = std::locale());
    template<typename Range1T, typename Range2T> 
      iterator_range< typename range_iterator< Range1T >::type > 
      find_nth(Range1T &, const Range2T &, int);
    template<typename Range1T, typename Range2T> 
      iterator_range< typename range_iterator< Range1T >::type > 
      ifind_nth(Range1T &, const Range2T &, int, 
                const std::locale & = std::locale());
    template<typename RangeT> 
      iterator_range< typename range_iterator< RangeT >::type > 
      find_head(RangeT &, int);
    template<typename RangeT> 
      iterator_range< typename range_iterator< RangeT >::type > 
      find_tail(RangeT &, int);
    template<typename RangeT, typename PredicateT> 
      iterator_range< typename range_iterator< RangeT >::type > 
      find_token(RangeT &, PredicateT, 
                 token_compress_mode_type = token_compress_off);
  }
}

Defines generic replace algorithms. Each algorithm replaces part(s) of the input. The part to be replaced is looked up using a Finder object. Result of finding is then used by a Formatter object to generate the replacement.

namespace boost {
  namespace algorithm {
    template<typename OutputIteratorT, typename RangeT, typename FinderT, 
             typename FormatterT> 
      OutputIteratorT 
      find_format_copy(OutputIteratorT, const RangeT &, FinderT, FormatterT);
    template<typename SequenceT, typename FinderT, typename FormatterT> 
      SequenceT find_format_copy(const SequenceT &, FinderT, FormatterT);
    template<typename SequenceT, typename FinderT, typename FormatterT> 
      void find_format(SequenceT &, FinderT, FormatterT);
    template<typename OutputIteratorT, typename RangeT, typename FinderT, 
             typename FormatterT> 
      OutputIteratorT 
      find_format_all_copy(OutputIteratorT, const RangeT &, FinderT, 
                           FormatterT);
    template<typename SequenceT, typename FinderT, typename FormatterT> 
      SequenceT find_format_all_copy(const SequenceT &, FinderT, FormatterT);
    template<typename SequenceT, typename FinderT, typename FormatterT> 
      void find_format_all(SequenceT &, FinderT, FormatterT);
  }
}

Defines find iterator classes. Find iterator repeatedly applies a Finder to the specified input string to search for matches. Dereferencing the iterator yields the current match or a range between the last and the current match depending on the iterator used.

namespace boost {
  namespace algorithm {
    template<typename IteratorT> class find_iterator;
    template<typename IteratorT> class split_iterator;
    template<typename RangeT, typename FinderT> 
      find_iterator< typename range_iterator< RangeT >::type > 
      make_find_iterator(RangeT &, FinderT);
    template<typename RangeT, typename FinderT> 
      split_iterator< typename range_iterator< RangeT >::type > 
      make_split_iterator(RangeT &, FinderT);
  }
}

Defines Finder generators. Finder object is a functor which is able to find a substring matching a specific criteria in the input. Finders are used as a pluggable components for replace, find and split facilities. This header contains generator functions for finders provided in this library.

namespace boost {
  namespace algorithm {
    template<typename RangeT> unspecified first_finder(const RangeT &);
    template<typename RangeT, typename PredicateT> 
      unspecified first_finder(const RangeT &, PredicateT);
    template<typename RangeT> unspecified last_finder(const RangeT &);
    template<typename RangeT, typename PredicateT> 
      unspecified last_finder(const RangeT &, PredicateT);
    template<typename RangeT> unspecified nth_finder(const RangeT &, int);
    template<typename RangeT, typename PredicateT> 
      unspecified nth_finder(const RangeT &, int, PredicateT);
    unspecified head_finder(int);
    unspecified tail_finder(int);
    template<typename PredicateT> 
      unspecified token_finder(PredicateT, 
                               token_compress_mode_type = token_compress_off);
    template<typename ForwardIteratorT> 
      unspecified range_finder(ForwardIteratorT, ForwardIteratorT);
    template<typename ForwardIteratorT> 
      unspecified range_finder(iterator_range< ForwardIteratorT >);
  }
}

Defines Formatter generators. Formatter is a functor which formats a string according to given parameters. A Formatter works in conjunction with a Finder. A Finder can provide additional information for a specific Formatter. An example of such a cooperation is regex_finder and regex_formatter.

Formatters are used as pluggable components for replace facilities. This header contains generator functions for the Formatters provided in this library.

namespace boost {
  namespace algorithm {
    template<typename RangeT> unspecified const_formatter(const RangeT &);
    template<typename RangeT> unspecified identity_formatter();
    template<typename RangeT> unspecified empty_formatter(const RangeT &);
    template<typename FinderT> unspecified dissect_formatter(const FinderT &);
  }
}

Defines generic split algorithms. Split algorithms can be used to divide a sequence into several part according to a given criteria. Result is given as a 'container of containers' where elements are copies or references to extracted parts.

There are two algorithms provided. One iterates over matching substrings, the other one over the gaps between these matches.

namespace boost {
  namespace algorithm {
    template<typename SequenceSequenceT, typename RangeT, typename FinderT> 
      SequenceSequenceT & iter_find(SequenceSequenceT &, RangeT &, FinderT);
    template<typename SequenceSequenceT, typename RangeT, typename FinderT> 
      SequenceSequenceT & iter_split(SequenceSequenceT &, RangeT &, FinderT);
  }
}

Defines join algorithm.

Join algorithm is a counterpart to split algorithms. It joins strings from a 'list' by adding user defined separator. Additionally there is a version that allows simple filtering by providing a predicate.

namespace boost {
  namespace algorithm {
    template<typename SequenceSequenceT, typename Range1T> 
      range_value< SequenceSequenceT >::type 
      join(const SequenceSequenceT &, const Range1T &);
    template<typename SequenceSequenceT, typename Range1T, 
             typename PredicateT> 
      range_value< SequenceSequenceT >::type 
      join_if(const SequenceSequenceT &, const Range1T &, PredicateT);
  }
}

Defines string-related predicates. The predicates determine whether a substring is contained in the input string under various conditions: a string starts with the substring, ends with the substring, simply contains the substring or if both strings are equal. Additionaly the algorithm all() checks all elements of a container to satisfy a condition.

All predicates provide the strong exception guarantee.

namespace boost {
  namespace algorithm {
    template<typename Range1T, typename Range2T, typename PredicateT> 
      bool starts_with(const Range1T &, const Range2T &, PredicateT);
    template<typename Range1T, typename Range2T> 
      bool starts_with(const Range1T &, const Range2T &);
    template<typename Range1T, typename Range2T> 
      bool istarts_with(const Range1T &, const Range2T &, 
                        const std::locale & = std::locale());
    template<typename Range1T, typename Range2T, typename PredicateT> 
      bool ends_with(const Range1T &, const Range2T &, PredicateT);
    template<typename Range1T, typename Range2T> 
      bool ends_with(const Range1T &, const Range2T &);
    template<typename Range1T, typename Range2T> 
      bool iends_with(const Range1T &, const Range2T &, 
                      const std::locale & = std::locale());
    template<typename Range1T, typename Range2T, typename PredicateT> 
      bool contains(const Range1T &, const Range2T &, PredicateT);
    template<typename Range1T, typename Range2T> 
      bool contains(const Range1T &, const Range2T &);
    template<typename Range1T, typename Range2T> 
      bool icontains(const Range1T &, const Range2T &, 
                     const std::locale & = std::locale());
    template<typename Range1T, typename Range2T, typename PredicateT> 
      bool equals(const Range1T &, const Range2T &, PredicateT);
    template<typename Range1T, typename Range2T> 
      bool equals(const Range1T &, const Range2T &);
    template<typename Range1T, typename Range2T> 
      bool iequals(const Range1T &, const Range2T &, 
                   const std::locale & = std::locale());
    template<typename Range1T, typename Range2T, typename PredicateT> 
      bool lexicographical_compare(const Range1T &, const Range2T &, 
                                   PredicateT);
    template<typename Range1T, typename Range2T> 
      bool lexicographical_compare(const Range1T &, const Range2T &);
    template<typename Range1T, typename Range2T> 
      bool ilexicographical_compare(const Range1T &, const Range2T &, 
                                    const std::locale & = std::locale());
    template<typename RangeT, typename PredicateT> 
      bool all(const RangeT &, PredicateT);
  }
}

Defines regex variants of the algorithms.

namespace boost {
  namespace algorithm {
    template<typename RangeT, typename CharT, typename RegexTraitsT> 
      iterator_range< typename range_iterator< RangeT >::type > 
      find_regex(RangeT &, const basic_regex< CharT, RegexTraitsT > &, 
                 match_flag_type = match_default);
    template<typename OutputIteratorT, typename RangeT, typename CharT, 
             typename RegexTraitsT, typename FormatStringTraitsT, 
             typename FormatStringAllocatorT> 
      OutputIteratorT 
      replace_regex_copy(OutputIteratorT, const RangeT &, 
                         const basic_regex< CharT, RegexTraitsT > &, 
                         const std::basic_string< CharT, FormatStringTraitsT, FormatStringAllocatorT > &, 
                         match_flag_type = match_default|format_default);
    template<typename SequenceT, typename CharT, typename RegexTraitsT, 
             typename FormatStringTraitsT, typename FormatStringAllocatorT> 
      SequenceT replace_regex_copy(const SequenceT &, 
                                   const basic_regex< CharT, RegexTraitsT > &, 
                                   const std::basic_string< CharT, FormatStringTraitsT, FormatStringAllocatorT > &, 
                                   match_flag_type = match_default|format_default);
    template<typename SequenceT, typename CharT, typename RegexTraitsT, 
             typename FormatStringTraitsT, typename FormatStringAllocatorT> 
      void replace_regex(SequenceT &, 
                         const basic_regex< CharT, RegexTraitsT > &, 
                         const std::basic_string< CharT, FormatStringTraitsT, FormatStringAllocatorT > &, 
                         match_flag_type = match_default|format_default);
    template<typename OutputIteratorT, typename RangeT, typename CharT, 
             typename RegexTraitsT, typename FormatStringTraitsT, 
             typename FormatStringAllocatorT> 
      OutputIteratorT 
      replace_all_regex_copy(OutputIteratorT, const RangeT &, 
                             const basic_regex< CharT, RegexTraitsT > &, 
                             const std::basic_string< CharT, FormatStringTraitsT, FormatStringAllocatorT > &, 
                             match_flag_type = match_default|format_default);
    template<typename SequenceT, typename CharT, typename RegexTraitsT, 
             typename FormatStringTraitsT, typename FormatStringAllocatorT> 
      SequenceT replace_all_regex_copy(const SequenceT &, 
                                       const basic_regex< CharT, RegexTraitsT > &, 
                                       const std::basic_string< CharT, FormatStringTraitsT, FormatStringAllocatorT > &, 
                                       match_flag_type = match_default|format_default);
    template<typename SequenceT, typename CharT, typename RegexTraitsT, 
             typename FormatStringTraitsT, typename FormatStringAllocatorT> 
      void replace_all_regex(SequenceT &, 
                             const basic_regex< CharT, RegexTraitsT > &, 
                             const std::basic_string< CharT, FormatStringTraitsT, FormatStringAllocatorT > &, 
                             match_flag_type = match_default|format_default);
    template<typename OutputIteratorT, typename RangeT, typename CharT, 
             typename RegexTraitsT> 
      OutputIteratorT 
      erase_regex_copy(OutputIteratorT, const RangeT &, 
                       const basic_regex< CharT, RegexTraitsT > &, 
                       match_flag_type = match_default);
    template<typename SequenceT, typename CharT, typename RegexTraitsT> 
      SequenceT erase_regex_copy(const SequenceT &, 
                                 const basic_regex< CharT, RegexTraitsT > &, 
                                 match_flag_type = match_default);
    template<typename SequenceT, typename CharT, typename RegexTraitsT> 
      void erase_regex(SequenceT &, 
                       const basic_regex< CharT, RegexTraitsT > &, 
                       match_flag_type = match_default);
    template<typename OutputIteratorT, typename RangeT, typename CharT, 
             typename RegexTraitsT> 
      OutputIteratorT 
      erase_all_regex_copy(OutputIteratorT, const RangeT &, 
                           const basic_regex< CharT, RegexTraitsT > &, 
                           match_flag_type = match_default);
    template<typename SequenceT, typename CharT, typename RegexTraitsT> 
      SequenceT erase_all_regex_copy(const SequenceT &, 
                                     const basic_regex< CharT, RegexTraitsT > &, 
                                     match_flag_type = match_default);
    template<typename SequenceT, typename CharT, typename RegexTraitsT> 
      void erase_all_regex(SequenceT &, 
                           const basic_regex< CharT, RegexTraitsT > &, 
                           match_flag_type = match_default);
    template<typename SequenceSequenceT, typename RangeT, typename CharT, 
             typename RegexTraitsT> 
      SequenceSequenceT & 
      find_all_regex(SequenceSequenceT &, const RangeT &, 
                     const basic_regex< CharT, RegexTraitsT > &, 
                     match_flag_type = match_default);
    template<typename SequenceSequenceT, typename RangeT, typename CharT, 
             typename RegexTraitsT> 
      SequenceSequenceT & 
      split_regex(SequenceSequenceT &, const RangeT &, 
                  const basic_regex< CharT, RegexTraitsT > &, 
                  match_flag_type = match_default);
    template<typename SequenceSequenceT, typename Range1T, typename CharT, 
             typename RegexTraitsT> 
      range_value< SequenceSequenceT >::type 
      join_if(const SequenceSequenceT &, const Range1T &, 
              const basic_regex< CharT, RegexTraitsT > &, 
              match_flag_type = match_default);
  }
}

Defines the regex_finder and regex_formatter generators. These two functors are designed to work together. regex_formatter uses additional information about a match contained in the regex_finder search result.

namespace boost {
  namespace algorithm {
    template<typename CharT, typename RegexTraitsT> 
      unspecified regex_finder(const basic_regex< CharT, RegexTraitsT > &, 
                               match_flag_type = match_default);
    template<typename CharT, typename TraitsT, typename AllocT> 
      unspecified regex_formatter(const std::basic_string< CharT, TraitsT, AllocT > &, 
                                  match_flag_type = format_default);
  }
}

Defines various replace algorithms. Each algorithm replaces part(s) of the input according to set of searching and replace criteria.

namespace boost {
  namespace algorithm {
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
      OutputIteratorT 
      replace_range_copy(OutputIteratorT, const Range1T &, 
                         const iterator_range< typename range_const_iterator< Range1T >::type > &, 
                         const Range2T &);
    template<typename SequenceT, typename RangeT> 
      SequenceT replace_range_copy(const SequenceT &, 
                                   const iterator_range< typename range_const_iterator< SequenceT >::type > &, 
                                   const RangeT &);
    template<typename SequenceT, typename RangeT> 
      void replace_range(SequenceT &, 
                         const iterator_range< typename range_iterator< SequenceT >::type > &, 
                         const RangeT &);
    template<typename OutputIteratorT, typename Range1T, typename Range2T, 
             typename Range3T> 
      OutputIteratorT 
      replace_first_copy(OutputIteratorT, const Range1T &, const Range2T &, 
                         const Range3T &);
    template<typename SequenceT, typename Range1T, typename Range2T> 
      SequenceT replace_first_copy(const SequenceT &, const Range1T &, 
                                   const Range2T &);
    template<typename SequenceT, typename Range1T, typename Range2T> 
      void replace_first(SequenceT &, const Range1T &, const Range2T &);
    template<typename OutputIteratorT, typename Range1T, typename Range2T, 
             typename Range3T> 
      OutputIteratorT 
      ireplace_first_copy(OutputIteratorT, const Range1T &, const Range2T &, 
                          const Range3T &, 
                          const std::locale & = std::locale());
    template<typename SequenceT, typename Range2T, typename Range1T> 
      SequenceT ireplace_first_copy(const SequenceT &, const Range2T &, 
                                    const Range1T &, 
                                    const std::locale & = std::locale());
    template<typename SequenceT, typename Range1T, typename Range2T> 
      void ireplace_first(SequenceT &, const Range1T &, const Range2T &, 
                          const std::locale & = std::locale());
    template<typename OutputIteratorT, typename Range1T, typename Range2T, 
             typename Range3T> 
      OutputIteratorT 
      replace_last_copy(OutputIteratorT, const Range1T &, const Range2T &, 
                        const Range3T &);
    template<typename SequenceT, typename Range1T, typename Range2T> 
      SequenceT replace_last_copy(const SequenceT &, const Range1T &, 
                                  const Range2T &);
    template<typename SequenceT, typename Range1T, typename Range2T> 
      void replace_last(SequenceT &, const Range1T &, const Range2T &);
    template<typename OutputIteratorT, typename Range1T, typename Range2T, 
             typename Range3T> 
      OutputIteratorT 
      ireplace_last_copy(OutputIteratorT, const Range1T &, const Range2T &, 
                         const Range3T &, 
                         const std::locale & = std::locale());
    template<typename SequenceT, typename Range1T, typename Range2T> 
      SequenceT ireplace_last_copy(const SequenceT &, const Range1T &, 
                                   const Range2T &, 
                                   const std::locale & = std::locale());
    template<typename SequenceT, typename Range1T, typename Range2T> 
      void ireplace_last(SequenceT &, const Range1T &, const Range2T &, 
                         const std::locale & = std::locale());
    template<typename OutputIteratorT, typename Range1T, typename Range2T, 
             typename Range3T> 
      OutputIteratorT 
      replace_nth_copy(OutputIteratorT, const Range1T &, const Range2T &, int, 
                       const Range3T &);
    template<typename SequenceT, typename Range1T, typename Range2T> 
      SequenceT replace_nth_copy(const SequenceT &, const Range1T &, int, 
                                 const Range2T &);
    template<typename SequenceT, typename Range1T, typename Range2T> 
      void replace_nth(SequenceT &, const Range1T &, int, const Range2T &);
    template<typename OutputIteratorT, typename Range1T, typename Range2T, 
             typename Range3T> 
      OutputIteratorT 
      ireplace_nth_copy(OutputIteratorT, const Range1T &, const Range2T &, 
                        int, const Range3T &, 
                        const std::locale & = std::locale());
    template<typename SequenceT, typename Range1T, typename Range2T> 
      SequenceT ireplace_nth_copy(const SequenceT &, const Range1T &, int, 
                                  const Range2T &, 
                                  const std::locale & = std::locale());
    template<typename SequenceT, typename Range1T, typename Range2T> 
      void ireplace_nth(SequenceT &, const Range1T &, int, const Range2T &, 
                        const std::locale & = std::locale());
    template<typename OutputIteratorT, typename Range1T, typename Range2T, 
             typename Range3T> 
      OutputIteratorT 
      replace_all_copy(OutputIteratorT, const Range1T &, const Range2T &, 
                       const Range3T &);
    template<typename SequenceT, typename Range1T, typename Range2T> 
      SequenceT replace_all_copy(const SequenceT &, const Range1T &, 
                                 const Range2T &);
    template<typename SequenceT, typename Range1T, typename Range2T> 
      void replace_all(SequenceT &, const Range1T &, const Range2T &);
    template<typename OutputIteratorT, typename Range1T, typename Range2T, 
             typename Range3T> 
      OutputIteratorT 
      ireplace_all_copy(OutputIteratorT, const Range1T &, const Range2T &, 
                        const Range3T &, const std::locale & = std::locale());
    template<typename SequenceT, typename Range1T, typename Range2T> 
      SequenceT ireplace_all_copy(const SequenceT &, const Range1T &, 
                                  const Range2T &, 
                                  const std::locale & = std::locale());
    template<typename SequenceT, typename Range1T, typename Range2T> 
      void ireplace_all(SequenceT &, const Range1T &, const Range2T &, 
                        const std::locale & = std::locale());
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
      OutputIteratorT 
      replace_head_copy(OutputIteratorT, const Range1T &, int, 
                        const Range2T &);
    template<typename SequenceT, typename RangeT> 
      SequenceT replace_head_copy(const SequenceT &, int, const RangeT &);
    template<typename SequenceT, typename RangeT> 
      void replace_head(SequenceT &, int, const RangeT &);
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
      OutputIteratorT 
      replace_tail_copy(OutputIteratorT, const Range1T &, int, 
                        const Range2T &);
    template<typename SequenceT, typename RangeT> 
      SequenceT replace_tail_copy(const SequenceT &, int, const RangeT &);
    template<typename SequenceT, typename RangeT> 
      void replace_tail(SequenceT &, int, const RangeT &);
  }
}

Traits defined in this header are used by various algorithms to achieve better performance for specific containers. Traits provide fail-safe defaults. If a container supports some of these features, it is possible to specialize the specific trait for this container. For lacking compilers, it is possible of define an override for a specific tester function.

Due to a language restriction, it is not currently possible to define specializations for stl containers without including the corresponding header. To decrease the overhead needed by this inclusion, user can selectively include a specialization header for a specific container. They are located in boost/algorithm/string/stl directory. Alternatively she can include boost/algorithm/string/std_collection_traits.hpp header which contains specializations for all stl containers.

namespace boost {
  namespace algorithm {
    template<typename T> class has_native_replace;
    template<typename T> class has_stable_iterators;
    template<typename T> class has_const_time_insert;
    template<typename T> class has_const_time_erase;
  }
}

Defines basic split algorithms. Split algorithms can be used to divide a string into several parts according to given criteria.

Each part is copied and added as a new element to the output container. Thus the result container must be able to hold copies of the matches (in a compatible structure like std::string) or a reference to it (e.g. using the iterator range class). Examples of such a container are std::vector<std::string> or std::list<boost::iterator_range<std::string::iterator>>

namespace boost {
  namespace algorithm {
    template<typename SequenceSequenceT, typename Range1T, typename Range2T> 
      SequenceSequenceT & 
      find_all(SequenceSequenceT &, Range1T &, const Range2T &);
    template<typename SequenceSequenceT, typename Range1T, typename Range2T> 
      SequenceSequenceT & 
      ifind_all(SequenceSequenceT &, Range1T &, const Range2T &, 
                const std::locale & = std::locale());
    template<typename SequenceSequenceT, typename RangeT, typename PredicateT> 
      SequenceSequenceT & 
      split(SequenceSequenceT &, RangeT &, PredicateT, 
            token_compress_mode_type = token_compress_off);
  }
}

This file includes sequence traits for stl containers.

Defines trim algorithms. Trim algorithms are used to remove trailing and leading spaces from a sequence (string). Space is recognized using given locales.

Parametric (_if) variants use a predicate (functor) to select which characters are to be trimmed.. Functions take a selection predicate as a parameter, which is used to determine whether a character is a space. Common predicates are provided in classification.hpp header.

namespace boost {
  namespace algorithm {
    template<typename OutputIteratorT, typename RangeT, typename PredicateT> 
      OutputIteratorT 
      trim_left_copy_if(OutputIteratorT, const RangeT &, PredicateT);
    template<typename SequenceT, typename PredicateT> 
      SequenceT trim_left_copy_if(const SequenceT &, PredicateT);
    template<typename SequenceT> 
      SequenceT trim_left_copy(const SequenceT &, 
                               const std::locale & = std::locale());
    template<typename SequenceT, typename PredicateT> 
      void trim_left_if(SequenceT &, PredicateT);
    template<typename SequenceT> 
      void trim_left(SequenceT &, const std::locale & = std::locale());
    template<typename OutputIteratorT, typename RangeT, typename PredicateT> 
      OutputIteratorT 
      trim_right_copy_if(OutputIteratorT, const RangeT &, PredicateT);
    template<typename SequenceT, typename PredicateT> 
      SequenceT trim_right_copy_if(const SequenceT &, PredicateT);
    template<typename SequenceT> 
      SequenceT trim_right_copy(const SequenceT &, 
                                const std::locale & = std::locale());
    template<typename SequenceT, typename PredicateT> 
      void trim_right_if(SequenceT &, PredicateT);
    template<typename SequenceT> 
      void trim_right(SequenceT &, const std::locale & = std::locale());
    template<typename OutputIteratorT, typename RangeT, typename PredicateT> 
      OutputIteratorT 
      trim_copy_if(OutputIteratorT, const RangeT &, PredicateT);
    template<typename SequenceT, typename PredicateT> 
      SequenceT trim_copy_if(const SequenceT &, PredicateT);
    template<typename SequenceT> 
      SequenceT trim_copy(const SequenceT &, 
                          const std::locale & = std::locale());
    template<typename SequenceT, typename PredicateT> 
      void trim_if(SequenceT &, PredicateT);
    template<typename SequenceT> 
      void trim(SequenceT &, const std::locale & = std::locale());
  }
}

Defines trim_all algorithms.

Just like trim, trim_all removes all trailing and leading spaces from a sequence (string). In addition, spaces in the middle of the sequence are truncated to just one character. Space is recognized using given locales.

trim_fill acts as trim_all, but the spaces in the middle are replaces with a user-define sequence of character.

Parametric (_if) variants use a predicate (functor) to select which characters are to be trimmed.. Functions take a selection predicate as a parameter, which is used to determine whether a character is a space. Common predicates are provided in classification.hpp header.

namespace boost {
  namespace algorithm {
    template<typename SequenceT, typename PredicateT> 
      SequenceT trim_all_copy_if(const SequenceT &, PredicateT);
    template<typename SequenceT, typename PredicateT> 
      void trim_all_if(SequenceT &, PredicateT);
    template<typename SequenceT> 
      SequenceT trim_all_copy(const SequenceT &, 
                              const std::locale & = std::locale());
    template<typename SequenceT> 
      void trim_all(SequenceT &, const std::locale & = std::locale());
    template<typename SequenceT, typename RangeT, typename PredicateT> 
      SequenceT trim_fill_copy_if(const SequenceT &, const RangeT &, 
                                  PredicateT);
    template<typename SequenceT, typename RangeT, typename PredicateT> 
      void trim_fill_if(SequenceT &, const RangeT &, PredicateT);
    template<typename SequenceT, typename RangeT> 
      SequenceT trim_fill_copy(const SequenceT &, const RangeT &, 
                               const std::locale & = std::locale());
    template<typename SequenceT, typename RangeT> 
      void trim_fill(SequenceT &, const RangeT &, 
                     const std::locale & = std::locale());
  }
}

Cumulative include for string_algo library. In addition to string.hpp contains also regex-related stuff.


PrevUpHomeNext