Topic: Typo in 21.3.6.4 basic_string::find_last_of


Author: Bruce Visscher <bvisscher@mindspring.com>
Date: 1999/03/08
Raw View
There appears to be a typo in 21.3.6.4 in the standard.

>     21.3.6.4 basic_string::find_last_of                     [lib.string::find.last.of]
>
>          size_type
>            find_last_of(const basic_string& str,
>                         size_type pos=npos) const;
>
> 1   Effects: Determines the highest position xpos, if possible, such that both of the following conditions
>     obtain:
>
>     -- xpos <= pos and pos < size();
>

I think this should be "xpos <= pos and xpos < size();".  Otherwise,
find_last_of would always have to return npos if the second argument
(pos) is defaulted, regardless of anything else.

>     -- at(xpos) == str.at(I) for some element I of the string controlled by str.
> 2   Returns: xpos if the function can determine such a value for xpos.  Otherwise, returns npos.
> 3   Notes: Uses traits::eq().
>

Likewise, in 21.3.6.6 (find_last_not_of).  I'm sure I'm not the first to
notice this.  Has this been reported?

Bruce



[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]