+ SimpleHash(const SimpleHash&);
+ SimpleHash& operator=(const SimpleHash&);
+
+public:
+ SimpleHash() {
+
+ entries = new (std::nothrow) Entry[HashSize];
+ if (!entries)
+ {
+ std::cerr << "Failed to allocate " << HashSize * sizeof(Entry)
+ << " bytes for material hash table." << std::endl;
+ exit(EXIT_FAILURE);
+ }
+ memset(entries, 0, HashSize * sizeof(Entry));
+ }
+
+ virtual ~SimpleHash() { delete [] entries; }
+
+ Entry* find(Key key) const { return entries + ((uint32_t)key & (HashSize - 1)); }
+
+protected:
+ Entry* entries;
+};