Skip to content

Commit 4593be7

Browse files
committed
File: Add std::hash() template for juce::File
Adds compatibility with STL hash maps and hash sets
1 parent be58c6d commit 4593be7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

modules/juce_core/files/juce_File.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,3 +1187,13 @@ class JUCE_API File final
11871187
};
11881188

11891189
} // namespace juce
1190+
1191+
/** @cond */
1192+
namespace std
1193+
{
1194+
template <> struct hash<juce::File>
1195+
{
1196+
size_t operator() (const juce::File& f) const noexcept { return (size_t) f.hashCode64(); }
1197+
};
1198+
}
1199+
/** @endcond */

0 commit comments

Comments
 (0)