BillyONeal added inline comments.

================
Comment at: test/std/strings/basic.string/string.cons/T_size_size.pass.cpp:39
         assert(pos <= sv.size());
-        unsigned rlen = std::min<unsigned>(sv.size() - pos, n);
+        unsigned rlen = std::min(static_cast<unsigned>(sv.size()) - pos, n);
         assert(s2.size() == rlen);
----------------
EricWF wrote:
> The cast should happen after the subtraction, not before.
The cast happens before the subtraction because the invariant that size() is 
less than unsigned max is established on line 36 (by passing in an unsigned as 
the length).

Alternately, would it be better to just pass around size_ts here so that no 
casts would be necessary any longer?



https://reviews.llvm.org/D32574



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to