Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
1.0 KiB
C++
Raw Permalink Normal View History

2010-05-11 19:42:16 +00:00
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2010-05-11 19:42:16 +00:00
//
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
2010-05-11 19:42:16 +00:00
2017-01-21 00:02:12 +00:00
// <thread>
2010-05-11 19:42:16 +00:00
// template <class T>
// struct hash
// : public unary_function<T, size_t>
// {
// size_t operator()(T val) const;
// };
// Not very portable
#include <thread>
#include <cassert>
#include "test_macros.h"
2019-02-04 20:31:13 +00:00
int main(int, char**)
2010-05-11 19:42:16 +00:00
{
std::thread::id id1;
std::thread::id id2 = std::this_thread::get_id();
typedef std::hash<std::thread::id> H;
static_assert((std::is_same<typename H::argument_type, std::thread::id>::value), "" );
static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
ASSERT_NOEXCEPT(H()(id2));
2010-05-11 19:42:16 +00:00
H h;
assert(h(id1) != h(id2));
2019-02-04 20:31:13 +00:00
return 0;
2010-05-11 19:42:16 +00:00
}