//===----------------------------------------------------------------------===// // // 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. // //===----------------------------------------------------------------------===// // // template // struct hash // : public unary_function // { // size_t operator()(T val) const; // }; // Not very portable #include #include #include #include template void test() { static_assert((std::is_base_of, std::hash >::value), ""); std::hash h; for (int i = 0; i <= 5; ++i) { T t(i); if (sizeof(T) <= sizeof(std::size_t)) assert(h(t) == t); } } int main() { test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); }