[PATCH] D40586: Implement p0457r2 - String Prefix and Suffix Checking
Marshall Clow via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 28 18:07:08 PST 2017
mclow.lists added inline comments.
================
Comment at: include/string_view:577
+ bool starts_with(basic_string_view __s) const _NOEXCEPT
+ { return size() >= __s.size() && compare(0, __s.size(), __s) == 0; }
+
----------------
rsmith wrote:
> mclow.lists wrote:
> > rsmith wrote:
> > > Is this a conforming implementation? The `size()` check isn't part of the specification, and `compare` could run arbitrary user-supplied code, so the absence of a call to it seems observable.
> > >
> > > Don't get me wrong: I think this check is the right thing to do, and it only makes a difference if `traits::compare` has observable side-effects. But we should file a bug against the standard to get this check added there.
> > The code as specified in the paper has a bug in it ;-)
> > I'll be filing an LWG issue once we have a draft standard with these bits in it.
> You can get a copy of the new draft a few days early from here: https://github.com/cplusplus/draft/blob/master/papers/n4713.pdf
Thanks. I can also build it myself; but I'd like to refer to it in the issue, so I can wait a day or two.
https://reviews.llvm.org/D40586
More information about the cfe-commits
mailing list