Commit Graph

3 Commits

Author SHA1 Message Date
Avi Kivity
25168fc73d enum: fix std::hash<> non-specialization for enum types
SFINAE only works for substituted template parameters, not any complication
error (or it would be called CEINAE); therefore hash<T> for enums will fail
to compile, given a non-enum, rather than being ignored.

It's not possible to specialize hash<> for enums, since the primary template
does not have en extra Enable template argument for use with enable_if.  We
therefore rename it to enum_hash<> and require users to explicitly define
hash<MyEnum> as inheriting from it.
2015-03-01 13:36:30 +02:00
Avi Kivity
7f8d88371a Add LICENSE, NOTICE, and copyright headers to all source files.
The two files imported from the OSv project retain their original licenses.
2015-02-19 16:52:34 +02:00
Nadav Har'El
a9ef189a54 core: add support for enum types as hash-table keys
This patchs adds a header file, "core/enum.hh"; Code which includes
this header file will be able to use an enumerated type as the key in a
hash table.

The header file implements a hash function for *all* enumerated types,
by using the standard hash function of the underlying integer type.
2015-02-07 12:33:48 +02:00