[PATCH] [libcxx] Optimize vectors uninitialized construction of trivial types from an iterator range.

Marshall Clow mclow.lists at gmail.com
Tue Mar 31 09:48:10 PDT 2015


LGTM.


================
Comment at: include/vector:1394
@@ +1393,3 @@
+    typename iterator_traits<_ForwardIterator>::difference_type __new_size_diff = _VSTD::distance(__first, __last);
+    size_type __new_size = static_cast<size_type>(__new_size_diff);
+    if (__new_size <= capacity())
----------------
I would combine these two lines into one:
`size_type __new_size = static_cast<size_type>(_VSTD::distance(__first, __last));`

and not bother with `__new_size_diff`

http://reviews.llvm.org/D8109

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list