Skip to content

Commit 85ac315

Browse files
author
Daniel Kroening
authored
Merge pull request diffblue#2082 from thomasspriggs/default_dstring_hash
Specify default hash function of `dstringt` to STL.
2 parents 28c2e8b + dd73b1a commit 85ac315

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/util/dstring.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,18 @@ inline std::ostream &operator<<(std::ostream &out, const dstringt &a)
175175
return a.operator<<(out);
176176
}
177177

178+
// NOLINTNEXTLINE [allow specialisation within 'std']
179+
namespace std
180+
{
181+
/// Default hash function of `dstringt` for use with STL containers.
182+
template <>
183+
struct hash<dstringt> // NOLINT(readability/identifiers)
184+
{
185+
size_t operator()(const dstringt &dstring) const
186+
{
187+
return dstring.hash();
188+
}
189+
};
190+
}
191+
178192
#endif // CPROVER_UTIL_DSTRING_H

0 commit comments

Comments
 (0)