mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-23 10:07:41 +08:00
[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:
@@ -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);
|
||||
|
Reference in New Issue
Block a user