ENH: simplify hashing overloads of string-types
- this revises the changes made in 95cd8ee75c to replace the
SFINAE-type of handling of string hashes with direct definitions.
This places a bit more burden on the developer if creating hashable
classes derived from std::string or variants of Foam::string, but
improves reliability when linking.
STYLE: drop template key defaulting from HashSet
- this was never used and `HashSet<>` is much less transparent
than writing `HashSet<word>` or `wordHashSet`
This commit is contained in:
@ -62,11 +62,14 @@ namespace Foam
|
||||
{
|
||||
|
||||
// Forward Declarations
|
||||
class string;
|
||||
class word;
|
||||
class wordRe;
|
||||
class Istream;
|
||||
class Ostream;
|
||||
|
||||
template<class T> struct Hash;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class string Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -150,7 +153,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
//- Hashing functor for string and derived string classes
|
||||
//- Deprecated hashing functor - use hasher
|
||||
// \deprecated(2021-04) - use hasher
|
||||
struct hash : string::hasher {};
|
||||
|
||||
|
||||
@ -333,6 +337,17 @@ public:
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
//- Hashing for Foam::string
|
||||
template<> struct Hash<string> : string::hasher {};
|
||||
|
||||
//- Hashing for std:::string
|
||||
template<> struct Hash<std::string> : string::hasher {};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
//- Read operator
|
||||
|
||||
Reference in New Issue
Block a user