Boost logo

Boost Users :

Subject: Re: [Boost-users] [regex] match_results: signatures of position(sub) and length(sub) are different, why?
From: Frédéric Bron (frederic.bron_at_[hidden])
Date: 2012-12-14 00:43:40


> 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,

I see that the standard says:
difference_type length(size_type sub = 0) const;
difference_type position(size_type sub = 0) const;

Frédéric


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net