From 24b55c67f79b46cd5315f836eb014d599da9c4e2 Mon Sep 17 00:00:00 2001 From: Pavol Droba Date: Tue, 7 Mar 2006 13:09:36 +0000 Subject: [PATCH] added comments about negative indexes in _nth, _tail and _head algorithms [SVN r33255] --- include/boost/algorithm/string/erase.hpp | 16 ++++++++++++++-- include/boost/algorithm/string/find.hpp | 12 +++++++++--- include/boost/algorithm/string/predicate.hpp | 1 - include/boost/algorithm/string/replace.hpp | 20 ++++++++++++++++---- 4 files changed, 39 insertions(+), 10 deletions(-) diff --git a/include/boost/algorithm/string/erase.hpp b/include/boost/algorithm/string/erase.hpp index c005b69..3f6eae5 100644 --- a/include/boost/algorithm/string/erase.hpp +++ b/include/boost/algorithm/string/erase.hpp @@ -387,6 +387,7 @@ namespace boost { \param Input An input string \param Search A substring to be searched for \param Nth An index of the match to be replaced. The index is 0-based. + For negative N, matches are counted from the end of string. \return An output iterator pointing just after the last inserted character or a modified copy of the input @@ -433,6 +434,7 @@ namespace boost { \param Input An input string \param Search A substring to be searched for. \param Nth An index of the match to be replaced. The index is 0-based. + For negative N, matches are counted from the end of string. */ template inline void erase_nth( @@ -459,6 +461,7 @@ namespace boost { \param Input An input string \param Search A substring to be searched for. \param Nth An index of the match to be replaced. The index is 0-based. + For negative N, matches are counted from the end of string. \param Loc A locale used for case insensitive comparison \return An output iterator pointing just after the last inserted character or a modified copy of the input @@ -508,6 +511,7 @@ namespace boost { \param Input An input string \param Search A substring to be searched for. \param Nth An index of the match to be replaced. The index is 0-based. + For negative N, matches are counted from the end of string. \param Loc A locale used for case insensitive comparison */ template @@ -675,7 +679,9 @@ namespace boost { \param Output An output iterator to which the result will be copied \param Input An input string - \param N Length of the head + \param N Length of the head. + For N>=0, at most N characters are extracted. + For N<0, size(Input)-|N| characters are extracted. \return An output iterator pointing just after the last inserted character or a modified copy of the input @@ -719,6 +725,8 @@ namespace boost { \param Input An input string \param N Length of the head + For N>=0, at most N characters are extracted. + For N<0, size(Input)-|N| characters are extracted. */ template inline void erase_head( @@ -743,7 +751,9 @@ namespace boost { \param Output An output iterator to which the result will be copied \param Input An input string - \param N Length of the head + \param N Length of the head. + For N>=0, at most N characters are extracted. + For N<0, size(Input)-|N| characters are extracted. \return An output iterator pointing just after the last inserted character or a modified copy of the input @@ -787,6 +797,8 @@ namespace boost { \param Input An input string \param N Length of the head + For N>=0, at most N characters are extracted. + For N<0, size(Input)-|N| characters are extracted. */ template inline void erase_tail( diff --git a/include/boost/algorithm/string/find.hpp b/include/boost/algorithm/string/find.hpp index b5119ac..8c49ebe 100644 --- a/include/boost/algorithm/string/find.hpp +++ b/include/boost/algorithm/string/find.hpp @@ -176,6 +176,7 @@ namespace boost { \param Input A string which will be searched. \param Search A substring to be searched for. \param Nth An index (zero-indexed) of the match to be found. + For negative N, the matches are counted from the end of string. \return An \c iterator_range delimiting the match. Returned iterator is either \c Range1T::iterator or @@ -196,12 +197,13 @@ namespace boost { //! Find n-th algorithm ( case insensitive ). /*! - Search for the n-th (zero-indexed) occurence of the substring in the + Search for the n-th (zero-indexed) occurrence of the substring in the input. Searching is case insensitive. \param Input A string which will be searched. \param Search A substring to be searched for. - \param Nth An index (zero-indexed) of the match to be found. + \param Nth An index (zero-indexed) of the match to be found. + For negative N, the matches are counted from the end of string. \param Loc A locale used for case insensitive comparison \return An \c iterator_range delimiting the match. @@ -235,6 +237,8 @@ namespace boost { \param Input An input string \param N Length of the head + For N>=0, at most N characters are extracted. + For N<0, size(Input)-|N| characters are extracted. \return An \c iterator_range delimiting the match. Returned iterator is either \c Range1T::iterator or @@ -263,7 +267,9 @@ namespace boost { to be the tail. \param Input An input string - \param N Length of the tail + \param N Length of the tail. + For N>=0, at most N characters are extracted. + For N<0, size(Input)-|N| characters are extracted. \return An \c iterator_range delimiting the match. Returned iterator is either \c RangeT::iterator or diff --git a/include/boost/algorithm/string/predicate.hpp b/include/boost/algorithm/string/predicate.hpp index e6d021c..41ed456 100644 --- a/include/boost/algorithm/string/predicate.hpp +++ b/include/boost/algorithm/string/predicate.hpp @@ -393,7 +393,6 @@ namespace boost { \param Arg1 First argument \param Arg2 Second argument - \param Pred Comparison predicate \return The result of the test \note This function provides the strong exception-safety guarantee diff --git a/include/boost/algorithm/string/replace.hpp b/include/boost/algorithm/string/replace.hpp index 1017d0e..8f1a92c 100644 --- a/include/boost/algorithm/string/replace.hpp +++ b/include/boost/algorithm/string/replace.hpp @@ -428,6 +428,7 @@ namespace boost { \param Input An input string \param Search A substring to be searched for \param Nth An index of the match to be replaced. The index is 0-based. + For negative N, matches are counted from the end of string. \param Format A substitute string \return An output iterator pointing just after the last inserted character or a modified copy of the input @@ -478,6 +479,7 @@ namespace boost { \param Input An input string \param Search A substring to be searched for \param Nth An index of the match to be replaced. The index is 0-based. + For negative N, matches are counted from the end of string. \param Format A substitute string */ template @@ -507,6 +509,7 @@ namespace boost { \param Input An input string \param Search A substring to be searched for \param Nth An index of the match to be replaced. The index is 0-based. + For negative N, matches are counted from the end of string. \param Format A substitute string \param Loc A locale used for case insensitive comparison \return An output iterator pointing just after the last inserted character or @@ -561,6 +564,7 @@ namespace boost { \param Input An input string \param Search A substring to be searched for \param Nth An index of the match to be replaced. The index is 0-based. + For negative N, matches are counted from the end of string. \param Format A substitute string \param Loc A locale used for case insensitive comparison */ @@ -745,7 +749,9 @@ namespace boost { \param Output An output iterator to which the result will be copied \param Input An input string - \param N Length of the head + \param N Length of the head. + For N>=0, at most N characters are extracted. + For N<0, size(Input)-|N| characters are extracted. \param Format A substitute string \return An output iterator pointing just after the last inserted character or a modified copy of the input @@ -793,7 +799,9 @@ namespace boost { considered to be the head. The input sequence is modified in-place. \param Input An input string - \param N Length of the head + \param N Length of the head. + For N>=0, at most N characters are extracted. + For N<0, size(Input)-|N| characters are extracted. \param Format A substitute string */ template @@ -821,7 +829,9 @@ namespace boost { \param Output An output iterator to which the result will be copied \param Input An input string - \param N Length of the tail + \param N Length of the tail. + For N>=0, at most N characters are extracted. + For N<0, size(Input)-|N| characters are extracted. \param Format A substitute string \return An output iterator pointing just after the last inserted character or a modified copy of the input @@ -869,7 +879,9 @@ namespace boost { considered to be the tail. The input sequence is modified in-place. \param Input An input string - \param N Length of the tail + \param N Length of the tail. + For N>=0, at most N characters are extracted. + For N<0, size(Input)-|N| characters are extracted. \param Format A substitute string */ template