summaryrefslogtreecommitdiffstats
path: root/Common/interface
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-01-31 16:21:39 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-01-31 16:21:39 +0000
commit39df94a7ea93456e06d97f0efbca1c5d210b0f0d (patch)
treef211fdffffc34fa35bb7ecbaad85a78f704e78f5 /Common/interface
parentUpdated SPIRV-Tools module (fixes https://github.com/DiligentGraphics/Diligen... (diff)
downloadDiligentCore-39df94a7ea93456e06d97f0efbca1c5d210b0f0d.tar.gz
DiligentCore-39df94a7ea93456e06d97f0efbca1c5d210b0f0d.zip
Updated HashMapStringKey to define Hasher in the struct rather than in std
Diffstat (limited to 'Common/interface')
-rw-r--r--Common/interface/HashUtils.h30
1 files changed, 13 insertions, 17 deletions
diff --git a/Common/interface/HashUtils.h b/Common/interface/HashUtils.h
index 5107f3b9..d84af8cd 100644
--- a/Common/interface/HashUtils.h
+++ b/Common/interface/HashUtils.h
@@ -113,17 +113,17 @@ namespace Diligent
}
explicit // Make this constructor explicit to avoid unintentional string copies
- HashMapStringKey(const String &Str) :
+ HashMapStringKey(const String& Str) :
StrPtr( nullptr ),
Hash(0)
{
MakeCopy( Str.c_str() );
}
- HashMapStringKey(HashMapStringKey &&Key)noexcept :
- StringBuff( std::move(Key.StringBuff) ),
- StrPtr( std::move(Key.StrPtr) ),
- Hash(0)
+ HashMapStringKey(HashMapStringKey&& Key)noexcept :
+ StringBuff(std::move(Key.StringBuff)),
+ StrPtr (std::move(Key.StrPtr)),
+ Hash (0)
{
Key.StrPtr = nullptr;
Key.Hash = 0;
@@ -165,6 +165,14 @@ namespace Diligent
return Hash;
}
+ struct Hasher
+ {
+ size_t operator()( const HashMapStringKey &Key ) const
+ {
+ return Key.GetHash();
+ }
+ };
+
const Char* GetStr()const{ return StrPtr; }
private:
@@ -185,15 +193,3 @@ namespace Diligent
mutable size_t Hash;
};
}
-
-namespace std
-{
- template<>
- struct hash<Diligent::HashMapStringKey>
- {
- size_t operator()( const Diligent::HashMapStringKey &Key ) const
- {
- return Key.GetHash();
- }
- };
-}