Browse Source

Ability to create ResourceKey directly from the hash.

pull/107/head
Vladimír Vondruš 11 years ago
parent
commit
27352e706c
  1. 5
      src/Magnum/Resource.h

5
src/Magnum/Resource.h

@ -88,7 +88,10 @@ class ResourceKey: public Utility::MurmurHash2::Digest {
* Creates zero key. Note that it is not the same as calling other
* constructors with empty string.
*/
constexpr ResourceKey() {}
constexpr /*implicit*/ ResourceKey() {}
/** @brief Construct resource key directly from hashed value */
explicit ResourceKey(std::size_t key): Utility::MurmurHash2::Digest{Utility::MurmurHash2::Digest::fromByteArray(reinterpret_cast<const char*>(&key))} {}
/** @brief Constructor */
ResourceKey(const std::string& key): Utility::MurmurHash2::Digest(Utility::MurmurHash2()(key)) {}

Loading…
Cancel
Save