
On the following link, we can see that length and position member functions have different signatures: http://www.boost.org/doc/libs/1_52_0/libs/regex/doc/html/boost_regex/ref/mat...
difference_type length(int sub = 0) const; difference_type position(unsigned int sub = 0) const;
Why int for length(sub) and unsigned int for position(sub)?
In fact, the documentation is wrong, but there is still an issue. This is what is in match_results.hpp: difference_type length(int sub = 0) const; difference_type position(size_type sub = 0) const;
why such a difference?
It's historical: length() can be used with the "special" values -1 and -2 to obtain the length of prefix() and suffix(), that's deprecated, and I don't *think* it's documented anywhere anymore, but was retained for backwards compatibility. I guess after all this time it could be changed now, but I don't see it's causing any great harm either, John.