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/collection_traits.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/iterator_range.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 CollectionT> 
      OutputIteratorT 
      to_lower_copy(OutputIteratorT, const CollectionT &, 
                    const std::locale & = std::locale());
    template<typename SequenceT> 
      SequenceT to_lower_copy(const SequenceT &, 
                              const std::locale & = std::locale());
    template<typename MutableCollectionT> 
      void to_lower(MutableCollectionT &, const std::locale & = std::locale());
    template<typename OutputIteratorT, typename CollectionT> 
      OutputIteratorT 
      to_upper_copy(OutputIteratorT, const CollectionT &, 
                    const std::locale & = std::locale());
    template<typename SequenceT> 
      SequenceT to_upper_copy(const SequenceT &, 
                              const std::locale & = std::locale());
    template<typename MutableCollectionT> 
      void to_upper(MutableCollectionT &, 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 ContainerT> unspecified is_any_of(const ContainerT &);
    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 collection_traits class and related free-standing functions. This facility is used to unify the access to different types of collections. It allows the algorithms in the library to work with STL collections, c-style array, null-terminated c-strings (and more) using the same interface.

namespace boost {
  namespace algorithm {
    template<typename T> struct collection_traits;
    template<typename C> struct value_type_of;
    template<typename C> struct difference_type_of;
    template<typename C> struct iterator_of;
    template<typename C> struct const_iterator_of;
    template<typename C> struct result_iterator_of;
    template<typename C> collection_traits< C >::size_type size(const C &);
    template<typename C> bool empty(const C &);
    template<typename C> collection_traits< C >::iterator begin(C &);
    template<typename C> 
      collection_traits< C >::const_iterator begin(const C &);
    template<typename C> collection_traits< C >::iterator end(C &);
    template<typename C> collection_traits< C >::const_iterator end(const C &);
  }
}

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 CollectionT> 
      OutputIteratorT 
      erase_range_copy(OutputIteratorT, const CollectionT &, 
                       const iterator_range< typename const_iterator_of< CollectionT >::type > &);
    template<typename SequenceT> 
      SequenceT erase_range_copy(const SequenceT &, 
                                 const iterator_range< typename const_iterator_of< SequenceT >::type > &);
    template<typename SequenceT> 
      void erase_range(SequenceT &, 
                       const iterator_range< typename iterator_of< SequenceT >::type > &);
    template<typename OutputIteratorT, typename Collection1T, 
             typename Collection2T> 
      OutputIteratorT 
      erase_first_copy(OutputIteratorT, const Collection1T &, 
                       const Collection2T &);
    template<typename SequenceT, typename CollectionT> 
      SequenceT erase_first_copy(const SequenceT &, const CollectionT &);
    template<typename SequenceT, typename CollectionT> 
      void erase_first(SequenceT &, const CollectionT &);
    template<typename OutputIteratorT, typename Collection1T, 
             typename Collection2T> 
      OutputIteratorT 
      ierase_first_copy(OutputIteratorT, const Collection1T &, 
                        const Collection2T &, 
                        const std::locale & = std::locale());
    template<typename SequenceT, typename CollectionT> 
      SequenceT ierase_first_copy(const SequenceT &, const CollectionT &, 
                                  const std::locale & = std::locale());
    template<typename SequenceT, typename CollectionT> 
      void ierase_first(SequenceT &, const CollectionT &, 
                        const std::locale & = std::locale());
    template<typename OutputIteratorT, typename Collection1T, 
             typename Collection2T> 
      OutputIteratorT 
      erase_last_copy(OutputIteratorT, const Collection1T &, 
                      const Collection2T &);
    template<typename SequenceT, typename CollectionT> 
      SequenceT erase_last_copy(const SequenceT &, const CollectionT &);
    template<typename SequenceT, typename CollectionT> 
      void erase_last(SequenceT &, const CollectionT &);
    template<typename OutputIteratorT, typename Collection1T, 
             typename Collection2T> 
      OutputIteratorT 
      ierase_last_copy(OutputIteratorT, const Collection1T &, 
                       const Collection2T &, 
                       const std::locale & = std::locale());
    template<typename SequenceT, typename CollectionT> 
      SequenceT ierase_last_copy(const SequenceT &, const CollectionT &, 
                                 const std::locale & = std::locale());
    template<typename SequenceT, typename CollectionT> 
      void ierase_last(SequenceT &, const CollectionT &, 
                       const std::locale & = std::locale());
    template<typename OutputIteratorT, typename Collection1T, 
             typename Collection2T> 
      OutputIteratorT 
      erase_nth_copy(OutputIteratorT, const Collection1T &, 
                     const Collection2T &, unsigned int);
    template<typename SequenceT, typename CollectionT> 
      SequenceT erase_nth_copy(const SequenceT &, const CollectionT &, 
                               unsigned int);
    template<typename SequenceT, typename CollectionT> 
      void erase_nth(SequenceT &, const CollectionT &, unsigned int);
    template<typename OutputIteratorT, typename Collection1T, 
             typename Collection2T> 
      OutputIteratorT 
      ierase_nth_copy(OutputIteratorT, const Collection1T &, 
                      const Collection2T &, unsigned int, 
                      const std::locale & = std::locale());
    template<typename SequenceT, typename CollectionT> 
      SequenceT ierase_nth_copy(const SequenceT &, const CollectionT &, 
                                unsigned int, 
                                const std::locale & = std::locale());
    template<typename SequenceT, typename CollectionT> 
      void ierase_nth(SequenceT &, const CollectionT &, unsigned int, 
                      const std::locale & = std::locale());
    template<typename OutputIteratorT, typename Collection1T, 
             typename Collection2T> 
      OutputIteratorT 
      erase_all_copy(OutputIteratorT, const Collection1T &, 
                     const Collection2T &);
    template<typename SequenceT, typename CollectionT> 
      SequenceT erase_all_copy(const SequenceT &, const CollectionT &);
    template<typename SequenceT, typename CollectionT> 
      void erase_all(SequenceT &, const CollectionT &);
    template<typename OutputIteratorT, typename Collection1T, 
             typename Collection2T> 
      OutputIteratorT 
      ierase_all_copy(OutputIteratorT, const Collection1T &, 
                      const Collection2T &, 
                      const std::locale & = std::locale());
    template<typename SequenceT, typename CollectionT> 
      SequenceT ierase_all_copy(const SequenceT &, const CollectionT &, 
                                const std::locale & = std::locale());
    template<typename SequenceT, typename CollectionT> 
      void ierase_all(SequenceT &, const CollectionT &, 
                      const std::locale & = std::locale());
    template<typename OutputIteratorT, typename CollectionT> 
      OutputIteratorT 
      erase_head_copy(OutputIteratorT, const CollectionT &, 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 CollectionT> 
      OutputIteratorT 
      erase_tail_copy(OutputIteratorT, const CollectionT &, 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 CollectionT, typename FinderT> 
      iterator_range< typename result_iterator_of< CollectionT >::type > 
      find(CollectionT &, FinderT);
    template<typename Collection1T, typename Collection2T> 
      iterator_range< typename result_iterator_of< Collection1T >::type > 
      find_first(Collection1T &, const Collection2T &);
    template<typename Collection1T, typename Collection2T> 
      iterator_range< typename result_iterator_of< Collection1T >::type > 
      ifind_first(Collection1T &, const Collection2T &, 
                  const std::locale & = std::locale());
    template<typename Collection1T, typename Collection2T> 
      iterator_range< typename result_iterator_of< Collection1T >::type > 
      find_last(Collection1T &, const Collection2T &);
    template<typename Collection1T, typename Collection2T> 
      iterator_range< typename result_iterator_of< Collection1T >::type > 
      ifind_last(Collection1T &, const Collection2T &, 
                 const std::locale & = std::locale());
    template<typename Collection1T, typename Collection2T> 
      iterator_range< typename result_iterator_of< Collection1T >::type > 
      find_nth(Collection1T &, const Collection2T &, unsigned int);
    template<typename Collection1T, typename Collection2T> 
      iterator_range< typename result_iterator_of< Collection1T >::type > 
      ifind_nth(Collection1T &, const Collection2T &, unsigned int, 
                const std::locale & = std::locale());
    template<typename CollectionT> 
      iterator_range< typename result_iterator_of< CollectionT >::type > 
      find_head(CollectionT &, unsigned int);
    template<typename CollectionT> 
      iterator_range< typename result_iterator_of< CollectionT >::type > 
      find_tail(CollectionT &, unsigned int);
    template<typename CollectionT, typename PredicateT> 
      iterator_range< typename result_iterator_of< CollectionT >::type > 
      find_token(CollectionT &, 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 CollectionT, typename FinderT, 
             typename FormatterT> 
      OutputIteratorT 
      find_format_copy(OutputIteratorT, const CollectionT &, 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 CollectionT, typename FinderT, 
             typename FormatterT> 
      OutputIteratorT 
      find_format_all_copy(OutputIteratorT, const CollectionT &, 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, typename RegexAllocatorT> 
      unspecified regex_finder(const reg_expression< CharT, RegexTraitsT, RegexAllocatorT > &, 
                               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 CollectionT, typename FinderT> 
      find_iterator< typename result_iterator_of< CollectionT >::type > 
      make_find_iterator(CollectionT &, FinderT);
    template<typename CollectionT, typename FinderT> 
      split_iterator< typename result_iterator_of< CollectionT >::type > 
      make_split_iterator(CollectionT &, 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 CollectionT> 
      unspecified const_formatter(const CollectionT &);
    template<typename CollectionT> unspecified identity_formatter();
    template<typename CollectionT> 
      unspecified empty_formatter(const CollectionT &);
  }
}

Defines the iterator_class and related functions. iterator_range is a simple wrapper of the iterator pair idiom. It provides a rich subset of the Container interface.

namespace boost {
  namespace algorithm {
    template<typename IteratorT> class iterator_range;
    template<typename IteratorT, typename Elem, typename Traits> 
      std::basic_ostream< Elem, Traits > & 
      operator<<(std::basic_ostream< Elem, Traits > &, 
                 const iterator_range< IteratorT > &);
    template<typename IteratorT> 
      iterator_range< IteratorT > make_iterator_range(IteratorT, IteratorT);
    template<typename IteratorT> 
      iterator_range< IteratorT > 
      make_iterator_range(const std::pair< IteratorT, IteratorT > &);
    template<typename SeqT, typename IteratorT> 
      SeqT copy_iterator_range(const iterator_range< IteratorT > &);
    template<typename SeqT, typename IteratorT, typename FuncT> 
      SeqT transform_iterator_range(const iterator_range< IteratorT > &, 
                                    FuncT);
  }
}

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 Collection1T, typename Collection2T, 
             typename PredicateT> 
      bool starts_with(const Collection1T &, const Collection2T &, PredicateT);
    template<typename Collection1T, typename Collection2T> 
      bool starts_with(const Collection1T &, const Collection2T &);
    template<typename Collection1T, typename Collection2T> 
      bool istarts_with(const Collection1T &, const Collection2T &, 
                        const std::locale & = std::locale());
    template<typename Collection1T, typename Collection2T, 
             typename PredicateT> 
      bool ends_with(const Collection1T &, const Collection2T &, PredicateT);
    template<typename Collection1T, typename Collection2T> 
      bool ends_with(const Collection1T &, const Collection2T &);
    template<typename Collection1T, typename Collection2T> 
      bool iends_with(const Collection1T &, const Collection2T &, 
                      const std::locale & = std::locale());
    template<typename Collection1T, typename Collection2T, 
             typename PredicateT> 
      bool contains(const Collection1T &, const Collection2T &, PredicateT);
    template<typename Collection1T, typename Collection2T> 
      bool contains(const Collection1T &, const Collection2T &);
    template<typename Collection1T, typename Collection2T> 
      bool icontains(const Collection1T &, const Collection2T &, 
                     const std::locale & = std::locale());
    template<typename Collection1T, typename Collection2T, 
             typename PredicateT> 
      bool equals(const Collection1T &, const Collection2T &, PredicateT);
    template<typename Collection1T, typename Collection2T> 
      bool equals(const Collection1T &, const Collection2T &);
    template<typename Collection1T, typename Collection2T> 
      bool iequals(const Collection1T &, const Collection2T &, 
                   const std::locale & = std::locale());
    template<typename CollectionT, typename PredicateT> 
      bool all(const CollectionT &, PredicateT);
  }
}

Defines regex variants of the algorithms.

namespace boost {
  namespace algorithm {
    template<typename CollectionT, typename CharT, typename RegexTraitsT, 
             typename RegexAllocatorT> 
      iterator_range< typename result_iterator_of< CollectionT >::type > 
      find_regex(CollectionT &, 
                 const reg_expression< CharT, RegexTraitsT, RegexAllocatorT > &, 
                 match_flag_type = match_default);
    template<typename OutputIteratorT, typename CollectionT, typename CharT, 
             typename RegexTraitsT, typename RegexAllocatorT, 
             typename FormatStringTraitsT, typename FormatStringAllocatorT> 
      OutputIteratorT 
      replace_regex_copy(OutputIteratorT, const CollectionT &, 
                         const reg_expression< CharT, RegexTraitsT, RegexAllocatorT > &, 
                         const std::basic_string< CharT, FormatStringTraitsT, FormatStringAllocatorT > &, 
                         match_flag_type = match_default|format_default);
    template<typename SequenceT, typename CharT, typename RegexTraitsT, 
             typename RegexAllocatorT, typename FormatStringTraitsT, 
             typename FormatStringAllocatorT> 
      SequenceT replace_regex_copy(const SequenceT &, 
                                   const reg_expression< CharT, RegexTraitsT, RegexAllocatorT > &, 
                                   const std::basic_string< CharT, FormatStringTraitsT, FormatStringAllocatorT > &, 
                                   match_flag_type = match_default|format_default);
    template<typename SequenceT, typename CharT, typename RegexTraitsT, 
             typename RegexAllocatorT, typename FormatStringTraitsT, 
             typename FormatStringAllocatorT> 
      void replace_regex(SequenceT &, 
                         const reg_expression< CharT, RegexTraitsT, RegexAllocatorT > &, 
                         const std::basic_string< CharT, FormatStringTraitsT, FormatStringAllocatorT > &, 
                         match_flag_type = match_default|format_default);
    template<typename OutputIteratorT, typename CollectionT, typename CharT, 
             typename RegexTraitsT, typename RegexAllocatorT, 
             typename FormatStringTraitsT, typename FormatStringAllocatorT> 
      OutputIteratorT 
      replace_all_regex_copy(OutputIteratorT, const CollectionT &, 
                             const reg_expression< CharT, RegexTraitsT, RegexAllocatorT > &, 
                             const std::basic_string< CharT, FormatStringTraitsT, FormatStringAllocatorT > &, 
                             match_flag_type = match_default|format_default);
    template<typename SequenceT, typename CharT, typename RegexTraitsT, 
             typename RegexAllocatorT, typename FormatStringTraitsT, 
             typename FormatStringAllocatorT> 
      SequenceT replace_all_regex_copy(const SequenceT &, 
                                       const reg_expression< CharT, RegexTraitsT, RegexAllocatorT > &, 
                                       const std::basic_string< CharT, FormatStringTraitsT, FormatStringAllocatorT > &, 
                                       match_flag_type = match_default|format_default);
    template<typename SequenceT, typename CharT, typename RegexTraitsT, 
             typename RegexAllocatorT, typename FormatStringTraitsT, 
             typename FormatStringAllocatorT> 
      void replace_all_regex(SequenceT &, 
                             const reg_expression< CharT, RegexTraitsT, RegexAllocatorT > &, 
                             const std::basic_string< CharT, FormatStringTraitsT, FormatStringAllocatorT > &, 
                             match_flag_type = match_default|format_default);
    template<typename OutputIteratorT, typename CollectionT, typename CharT, 
             typename RegexTraitsT, typename RegexAllocatorT> 
      OutputIteratorT 
      erase_regex_copy(OutputIteratorT, const CollectionT &, 
                       const reg_expression< CharT, RegexTraitsT, RegexAllocatorT > &, 
                       match_flag_type = match_default);
    template<typename SequenceT, typename CharT, typename RegexTraitsT, 
             typename RegexAllocatorT> 
      SequenceT erase_regex_copy(const SequenceT &, 
                                 const reg_expression< CharT, RegexTraitsT, RegexAllocatorT > &, 
                                 match_flag_type = match_default);
    template<typename SequenceT, typename CharT, typename RegexTraitsT, 
             typename RegexAllocatorT> 
      void erase_regex(SequenceT &, 
                       const reg_expression< CharT, RegexTraitsT, RegexAllocatorT > &, 
                       match_flag_type = match_default);
    template<typename OutputIteratorT, typename CollectionT, typename CharT, 
             typename RegexTraitsT, typename RegexAllocatorT> 
      OutputIteratorT 
      erase_all_regex_copy(OutputIteratorT, const CollectionT &, 
                           const reg_expression< CharT, RegexTraitsT, RegexAllocatorT > &, 
                           match_flag_type = match_default);
    template<typename SequenceT, typename CharT, typename RegexTraitsT, 
             typename RegexAllocatorT> 
      SequenceT erase_all_regex_copy(const SequenceT &, 
                                     const reg_expression< CharT, RegexTraitsT, RegexAllocatorT > &, 
                                     match_flag_type = match_default);
    template<typename SequenceT, typename CharT, typename RegexTraitsT, 
             typename RegexAllocatorT> 
      void erase_all_regex(SequenceT &, 
                           const reg_expression< CharT, RegexTraitsT, RegexAllocatorT > &, 
                           match_flag_type = match_default);
    template<typename SequenceSequenceT, typename CollectionT, typename CharT, 
             typename RegexTraitsT, typename RegexAllocatorT> 
      SequenceSequenceT & 
      find_all_regex(SequenceSequenceT &, const CollectionT &, 
                     const reg_expression< CharT, RegexTraitsT, RegexAllocatorT > &, 
                     match_flag_type = match_default);
    template<typename SequenceSequenceT, typename CollectionT, typename CharT, 
             typename RegexTraitsT, typename RegexAllocatorT> 
      SequenceSequenceT & 
      split_regex(SequenceSequenceT &, const CollectionT &, 
                  const reg_expression< CharT, RegexTraitsT, RegexAllocatorT > &, 
                  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, typename RegexAllocatorT> 
      unspecified regex_finder(const reg_expression< CharT, RegexTraitsT, RegexAllocatorT > &, 
                               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 Collection1T, 
             typename Collection2T> 
      OutputIteratorT 
      replace_range_copy(OutputIteratorT, const Collection1T &, 
                         const iterator_range< typename const_iterator_of< Collection1T >::type > &, 
                         const Collection2T &);
    template<typename SequenceT, typename CollectionT> 
      SequenceT replace_range_copy(const SequenceT &, 
                                   const iterator_range< typename const_iterator_of< SequenceT >::type > &, 
                                   const CollectionT &);
    template<typename SequenceT, typename CollectionT> 
      void replace_range(SequenceT &, 
                         const iterator_range< typename iterator_of< SequenceT >::type > &, 
                         const CollectionT &);
    template<typename OutputIteratorT, typename Collection1T, 
             typename Collection2T, typename Collection3T> 
      OutputIteratorT 
      replace_first_copy(OutputIteratorT, const Collection1T &, 
                         const Collection2T &, const Collection3T &);
    template<typename SequenceT, typename Collection1T, typename Collection2T> 
      SequenceT replace_first_copy(const SequenceT &, const Collection1T &, 
                                   const Collection2T &);
    template<typename SequenceT, typename Collection1T, typename Collection2T> 
      void replace_first(SequenceT &, const Collection1T &, 
                         const Collection2T &);
    template<typename OutputIteratorT, typename Collection1T, 
             typename Collection2T, typename Collection3T> 
      OutputIteratorT 
      ireplace_first_copy(OutputIteratorT, const Collection1T &, 
                          const Collection2T &, const Collection3T &, 
                          const std::locale & = std::locale());
    template<typename SequenceT, typename Collection2T, typename Collection1T> 
      SequenceT ireplace_first_copy(const SequenceT &, const Collection2T &, 
                                    const Collection1T &, 
                                    const std::locale & = std::locale());
    template<typename SequenceT, typename Collection1T, typename Collection2T> 
      void ireplace_first(SequenceT &, const Collection1T &, 
                          const Collection2T &, 
                          const std::locale & = std::locale());
    template<typename OutputIteratorT, typename Collection1T, 
             typename Collection2T, typename Collection3T> 
      OutputIteratorT 
      replace_last_copy(OutputIteratorT, const Collection1T &, 
                        const Collection2T &, const Collection3T &);
    template<typename SequenceT, typename Collection1T, typename Collection2T> 
      SequenceT replace_last_copy(const SequenceT &, const Collection1T &, 
                                  const Collection2T &);
    template<typename SequenceT, typename Collection1T, typename Collection2T> 
      void replace_last(SequenceT &, const Collection1T &, 
                        const Collection2T &);
    template<typename OutputIteratorT, typename Collection1T, 
             typename Collection2T, typename Collection3T> 
      OutputIteratorT 
      ireplace_last_copy(OutputIteratorT, const Collection1T &, 
                         const Collection2T &, const Collection3T &, 
                         const std::locale & = std::locale());
    template<typename SequenceT, typename Collection1T, typename Collection2T> 
      SequenceT ireplace_last_copy(const SequenceT &, const Collection1T &, 
                                   const Collection2T &, 
                                   const std::locale & = std::locale());
    template<typename SequenceT, typename Collection1T, typename Collection2T> 
      void ireplace_last(SequenceT &, const Collection1T &, 
                         const Collection2T &, 
                         const std::locale & = std::locale());
    template<typename OutputIteratorT, typename Collection1T, 
             typename Collection2T, typename Collection3T> 
      OutputIteratorT 
      replace_nth_copy(OutputIteratorT, const Collection1T &, 
                       const Collection2T &, unsigned int, 
                       const Collection3T &);
    template<typename SequenceT, typename Collection1T, typename Collection2T> 
      SequenceT replace_nth_copy(const SequenceT &, const Collection1T &, 
                                 unsigned int, const Collection2T &);
    template<typename SequenceT, typename Collection1T, typename Collection2T> 
      void replace_nth(SequenceT &, const Collection1T &, unsigned int, 
                       const Collection2T &);
    template<typename OutputIteratorT, typename Collection1T, 
             typename Collection2T, typename Collection3T> 
      OutputIteratorT 
      ireplace_nth_copy(OutputIteratorT, const Collection1T &, 
                        const Collection2T &, unsigned int, 
                        const Collection3T &, 
                        const std::locale & = std::locale());
    template<typename SequenceT, typename Collection1T, typename Collection2T> 
      SequenceT ireplace_nth_copy(const SequenceT &, const Collection1T &, 
                                  unsigned int, const Collection2T &, 
                                  const std::locale & = std::locale());
    template<typename SequenceT, typename Collection1T, typename Collection2T> 
      void ireplace_nth(SequenceT &, const Collection1T &, unsigned int, 
                        const Collection2T &, 
                        const std::locale & = std::locale());
    template<typename OutputIteratorT, typename Collection1T, 
             typename Collection2T, typename Collection3T> 
      OutputIteratorT 
      replace_all_copy(OutputIteratorT, const Collection1T &, 
                       const Collection2T &, const Collection3T &);
    template<typename SequenceT, typename Collection1T, typename Collection2T> 
      SequenceT replace_all_copy(const SequenceT &, const Collection1T &, 
                                 const Collection2T &);
    template<typename SequenceT, typename Collection1T, typename Collection2T> 
      void replace_all(SequenceT &, const Collection1T &, 
                       const Collection2T &);
    template<typename OutputIteratorT, typename Collection1T, 
             typename Collection2T, typename Collection3T> 
      OutputIteratorT 
      ireplace_all_copy(OutputIteratorT, const Collection1T &, 
                        const Collection2T &, const Collection3T &, 
                        const std::locale & = std::locale());
    template<typename SequenceT, typename Collection1T, typename Collection2T> 
      SequenceT ireplace_all_copy(const SequenceT &, const Collection1T &, 
                                  const Collection2T &, 
                                  const std::locale & = std::locale());
    template<typename SequenceT, typename Collection1T, typename Collection2T> 
      void ireplace_all(SequenceT &, const Collection1T &, 
                        const Collection2T &, 
                        const std::locale & = std::locale());
    template<typename OutputIteratorT, typename Collection1T, 
             typename Collection2T> 
      OutputIteratorT 
      replace_head_copy(OutputIteratorT, const Collection1T &, unsigned int, 
                        const Collection2T &);
    template<typename SequenceT, typename CollectionT> 
      SequenceT replace_head_copy(const SequenceT &, unsigned int, 
                                  const CollectionT &);
    template<typename SequenceT, typename CollectionT> 
      void replace_head(SequenceT &, unsigned int, const CollectionT &);
    template<typename OutputIteratorT, typename Collection1T, 
             typename Collection2T> 
      OutputIteratorT 
      replace_tail_copy(OutputIteratorT, const Collection1T &, unsigned int, 
                        const Collection2T &);
    template<typename SequenceT, typename CollectionT> 
      SequenceT replace_tail_copy(const SequenceT &, unsigned int, 
                                  const CollectionT &);
    template<typename SequenceT, typename CollectionT> 
      void replace_tail(SequenceT &, unsigned int, const CollectionT &);
  }
}

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 Collection1T, 
             typename Collection2T> 
      SequenceSequenceT & 
      find_all(SequenceSequenceT &, Collection1T &, const Collection2T &);
    template<typename SequenceSequenceT, typename Collection1T, 
             typename Collection2T> 
      SequenceSequenceT & 
      ifind_all(SequenceSequenceT &, Collection1T &, const Collection2T &, 
                const std::locale & = std::locale());
    template<typename SequenceSequenceT, typename CollectionT, 
             typename PredicateT> 
      SequenceSequenceT & 
      split(SequenceSequenceT &, CollectionT &, 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 CollectionT, 
             typename PredicateT> 
      OutputIteratorT 
      trim_left_copy_if(OutputIteratorT, const CollectionT &, 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 CollectionT, 
             typename PredicateT> 
      OutputIteratorT 
      trim_right_copy_if(OutputIteratorT, const CollectionT &, 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 CollectionT, 
             typename PredicateT> 
      OutputIteratorT 
      trim_copy_if(OutputIteratorT, const CollectionT &, 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