boost.png (6897 bytes) Home Libraries People FAQ More

PrevUpHomeNext

Reference

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/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.hpp>
Header <boost/algorithm/string_regex.hpp>
Header <boost/algorithm/string/trim.hpp>

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;
  }
}

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 &, 
                     unsigned int);
    template<typename SequenceT, typename RangeT> 
      SequenceT erase_nth_copy(const SequenceT &, const RangeT &, 
                               unsigned int);
    template<typename SequenceT, typename RangeT> 
      void erase_nth(SequenceT &, const RangeT &, unsigned int);
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
      OutputIteratorT 
      ierase_nth_copy(OutputIteratorT, const Range1T &, const Range2T &, 
                      unsigned int, const std::locale & = std::locale());
    template<typename SequenceT, typename RangeT> 
      SequenceT ierase_nth_copy(const SequenceT &, const RangeT &, 
                                unsigned int, 
                                const std::locale & = std::locale());
    template<typename SequenceT, typename RangeT> 
      void ierase_nth(SequenceT &, const RangeT &, unsigned 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 &, unsigned int);
    template<typename SequenceT> 
      SequenceT erase_head_copy(const SequenceT &, unsigned int);
    template<typename SequenceT> void erase_head(SequenceT &, unsigned int);
    template<typename OutputIteratorT, typename RangeT> 
      OutputIteratorT 
      erase_tail_copy(OutputIteratorT, const RangeT &, unsigned int);
    template<typename SequenceT> 
      SequenceT erase_tail_copy(const SequenceT &, unsigned int);
    template<typename SequenceT> void erase_tail(SequenceT &, unsigned 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_result_iterator< RangeT >::type > 
      find(RangeT &, FinderT);
    template<typename Range1T, typename Range2T> 
      iterator_range< typename range_result_iterator< Range1T >::type > 
      find_first(Range1T &, const Range2T &);
    template<typename Range1T, typename Range2T> 
      iterator_range< typename range_result_iterator< Range1T >::type > 
      ifind_first(Range1T &, const Range2T &, 
                  const std::locale & = std::locale());
    template<typename Range1T, typename Range2T> 
      iterator_range< typename range_result_iterator< Range1T >::type > 
      find_last(Range1T &, const Range2T &);
    template<typename Range1T, typename Range2T> 
      iterator_range< typename range_result_iterator< Range1T >::type > 
      ifind_last(Range1T &, const Range2T &, 
                 const std::locale & = std::locale());
    template<typename Range1T, typename Range2T> 
      iterator_range< typename range_result_iterator< Range1T >::type > 
      find_nth(Range1T &, const Range2T &, unsigned int);
    template<typename Range1T, typename Range2T> 
      iterator_range< typename range_result_iterator< Range1T >::type > 
      ifind_nth(Range1T &, const Range2T &, unsigned int, 
                const std::locale & = std::locale());
    template<typename RangeT> 
      iterator_range< typename range_result_iterator< RangeT >::type > 
      find_head(RangeT &, unsigned int);
    template<typename RangeT> 
      iterator_range< typename range_result_iterator< RangeT >::type > 
      find_tail(RangeT &, unsigned int);
    template<typename RangeT, typename PredicateT> 
      iterator_range< typename range_result_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);
    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 find iterator classes. Find iterator repeatly 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_result_iterator< RangeT >::type > 
      make_find_iterator(RangeT &, FinderT);
    template<typename RangeT, typename FinderT> 
      split_iterator< typename range_result_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 ContainerT> unspecified first_finder(const ContainerT &);
    template<typename ContainerT, typename PredicateT> 
      unspecified first_finder(const ContainerT &, PredicateT);
    template<typename ContainerT> unspecified last_finder(const ContainerT &);
    template<typename ContainerT, typename PredicateT> 
      unspecified last_finder(const ContainerT &, PredicateT);
    template<typename ContainerT> 
      unspecified nth_finder(const ContainerT &, unsigned int);
    template<typename ContainerT, typename PredicateT> 
      unspecified nth_finder(const ContainerT &, unsigned int, PredicateT);
    unspecified head_finder(unsigned int);
    unspecified tail_finder(unsigned 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 &);
  }
}

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 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_result_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);
  }
}

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 &, 
                       unsigned int, const Range3T &);
    template<typename SequenceT, typename Range1T, typename Range2T> 
      SequenceT replace_nth_copy(const SequenceT &, const Range1T &, 
                                 unsigned int, const Range2T &);
    template<typename SequenceT, typename Range1T, typename Range2T> 
      void replace_nth(SequenceT &, const Range1T &, unsigned int, 
                       const Range2T &);
    template<typename OutputIteratorT, typename Range1T, typename Range2T, 
             typename Range3T> 
      OutputIteratorT 
      ireplace_nth_copy(OutputIteratorT, const Range1T &, const Range2T &, 
                        unsigned int, const Range3T &, 
                        const std::locale & = std::locale());
    template<typename SequenceT, typename Range1T, typename Range2T> 
      SequenceT ireplace_nth_copy(const SequenceT &, const Range1T &, 
                                  unsigned int, const Range2T &, 
                                  const std::locale & = std::locale());
    template<typename SequenceT, typename Range1T, typename Range2T> 
      void ireplace_nth(SequenceT &, const Range1T &, unsigned 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 &, unsigned int, 
                        const Range2T &);
    template<typename SequenceT, typename RangeT> 
      SequenceT replace_head_copy(const SequenceT &, unsigned int, 
                                  const RangeT &);
    template<typename SequenceT, typename RangeT> 
      void replace_head(SequenceT &, unsigned int, const RangeT &);
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
      OutputIteratorT 
      replace_tail_copy(OutputIteratorT, const Range1T &, unsigned int, 
                        const Range2T &);
    template<typename SequenceT, typename RangeT> 
      SequenceT replace_tail_copy(const SequenceT &, unsigned int, 
                                  const RangeT &);
    template<typename SequenceT, typename RangeT> 
      void replace_tail(SequenceT &, unsigned 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.

Cumulative include for string_algo library

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

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());
  }
}
Copyright © 2002-2004 Pavol Droba

PrevUpHomeNext