[libcxx] [test] D27014: Fix MSVC warning C4018 "signed/unsigned mismatch", part 2/12.

Add static_cast<std::size_t> when comparing int to std::size_t.

Also, include <cstddef> when it wasn't already being included.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287822 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Stephan T. Lavavej
2016-11-23 22:01:58 +00:00
parent a9bcd3dae8
commit 388c2a8e68
20 changed files with 83 additions and 65 deletions

View File

@@ -19,6 +19,7 @@
#include <functional>
#include <vector>
#include <cassert>
#include <cstddef>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <memory>
@@ -77,7 +78,7 @@ int main()
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::vector<std::unique_ptr<int> > v(1000);
for (int i = 0; i < v.size(); ++i)
for (int i = 0; static_cast<std::size_t>(i) < v.size(); ++i)
v[i].reset(new int(i));
std::nth_element(v.begin(), v.begin() + v.size()/2, v.end(), indirect_less());
assert(*v[v.size()/2] == v.size()/2);