Summary:
* folly/small_vector.h (moveToUninitialized): Do not mix
signed and unsigned for-loop index/limit. Instead, eliminate
the intermediate "count" altogether and iterate as long as
"first" is not equal to "last". Otherwise, gcc-4.9 fails with e.g.,
folly/small_vector.h:115:18: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
Test Plan:
Run this and note there are fewer errors than before:
fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
Reviewed By: soren@fb.com
Subscribers: trunkagent, folly-diffs@
FB internal diff:
D1767844
Tasks:
5941250
Signature: t1:
1767844:
1420601608:
987fd7f7d44197ed9919910c9b559b37fbe421b6
!FOLLY_IS_TRIVIALLY_COPYABLE(T)
>::type
moveToUninitialized(T* first, T* last, T* out) {
- auto const count = last - first;
std::size_t idx = 0;
try {
- for (; idx < count; ++first, ++idx) {
+ for (; first != last; ++first, ++idx) {
new (&out[idx]) T(std::move(*first));
}
} catch (...) {