diff options
Diffstat (limited to 'test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp')
-rw-r--r-- | test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp new file mode 100644 index 0000000000000..106c69e2e4a1f --- /dev/null +++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// UNSUPPORTED: libcpp-has-no-threads + +// <functional> + +// template <class T> +// struct hash +// : public unary_function<T, size_t> +// { +// size_t operator()(T val) const; +// }; + +// Not very portable + +#include <thread> +#include <cassert> + +int main() +{ + 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), "" ); + H h; + assert(h(id1) != h(id2)); +} |