{
typedef std::vector<bool> T;
typedef std::hash<T> H;
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- H>::value), "");
+ static_assert((std::is_same<H::argument_type, T>::value), "" );
+ static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
+
bool ba[] = {true, false, true, true, false};
T vb(std::begin(ba), std::end(ba));
H h;
{
typedef std::error_code T;
typedef std::hash<T> H;
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- H>::value), "");
+ static_assert((std::is_same<H::argument_type, T>::value), "" );
+ static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
H h;
T ec(i, std::system_category());
assert(h(ec) == i);
test()
{
typedef std::hash<T> H;
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- H>::value), "");
+ static_assert((std::is_same<typename H::argument_type, T>::value), "" );
+ static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
H h;
// std::string g1 = "1234567890";
// std::string g2 = "1234567891";
test()
{
typedef std::hash<T> H;
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- H>::value), "");
+ static_assert((std::is_same<typename H::argument_type, T>::value), "" );
+ static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
H h;
std::string g1 = "1234567890";
std::string g2 = "1234567891";
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));
}
void
test()
{
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- std::hash<T> >::value), "");
+ typedef std::hash<T> H;
+ static_assert((std::is_same<H::argument_type, T>::value), "" );
+ static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
typedef typename std::underlying_type<T>::type under_type;
- std::hash<T> h1;
+ H h1;
std::hash<under_type> h2;
for (int i = 0; i <= 5; ++i)
{
void
test()
{
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- std::hash<T> >::value), "");
- std::hash<T> h;
+ typedef std::hash<T> H;
+ static_assert((std::is_same<typename H::argument_type, T>::value), "" );
+ static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
+ H h;
+
std::size_t t0 = h(0.);
std::size_t tn0 = h(-0.);
std::size_t tp1 = h(0.1);
void
test()
{
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- std::hash<T> >::value), "");
- std::hash<T> h;
+ typedef std::hash<T> H;
+ static_assert((std::is_same<typename H::argument_type, T>::value), "" );
+ static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
+ H h;
+
for (int i = 0; i <= 5; ++i)
{
T t(i);
void
test()
{
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- std::hash<T> >::value), "");
- std::hash<T> h;
+ typedef std::hash<T> H;
+ static_assert((std::is_same<typename H::argument_type, T>::value), "" );
+ static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
+ H h;
+
typedef typename std::remove_pointer<T>::type type;
type i;
type j;
{
typedef std::bitset<N> T;
typedef std::hash<T> H;
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- H>::value), "");
+ static_assert((std::is_same<typename H::argument_type, T>::value), "" );
+ static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
H h;
T bs(static_cast<unsigned long long>(N));
assert(h(bs) == N);
int main()
{
- static_assert((std::is_base_of<std::unary_function<std::type_index, std::size_t>,
- std::hash<std::type_index> >::value), "");
+ typedef std::hash<std::type_index> H;
+ static_assert((std::is_same<typename H::argument_type, std::type_index>::value), "" );
+ static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
}