[PATCH] D48342: [libcxx] Optimize vectors construction of trivial types from an iterator range with const-ness mismatch.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 7 11:36:01 PST 2018


vsapsai added a comment.

Thanks for the feedback. Answered one simple question, the rest needs more time.



================
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);
----------------
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.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D48342/new/

https://reviews.llvm.org/D48342





More information about the cfe-commits mailing list