[PATCH] D48342: [libcxx] Optimize vectors construction of trivial types from an iterator range with const-ness mismatch.
Louis Dionne via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 7 11:54:30 PST 2018
ldionne added a comment.
If you use some of my suggestions, please make sure it compiles in C++03 mode. I might be using some C++11 features (not sure whether default argument for template parameters is C++03).
================
Comment at: libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp:186
+ std::vector<float> v(array, array + 3);
+ assert(std::fabs(v[0] - 0.0f) < FLT_EPSILON);
+ assert(std::fabs(v[1] - 1.0f) < FLT_EPSILON);
----------------
vsapsai wrote:
> ldionne wrote:
> > I do not understand this test, can you please explain?
> At some point I had implementation that was using memcpy for initialization in this case. But in memory `{0, 1, 2} != {0.0f, 1.0f, 2.0f}`. I think I'll change the test to initialize `vector<int>` with `float[]` and it will simplify asserts. Because currently those fabs and FLT_EPSILON are noisy and add unnecessary cognitive load.
Ok.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D48342/new/
https://reviews.llvm.org/D48342
More information about the cfe-commits
mailing list