Not sure how to keep Type out of the template while still referencing it from the templated class. i.e. How would I do this: "DualLookup::Type"?
This commit is contained in:
14
DualLookup.h
14
DualLookup.h
@@ -2,11 +2,8 @@
|
||||
#define DVEREB_DUALLOOKUP_H
|
||||
|
||||
#include <unordered_map>
|
||||
template <class T>
|
||||
class DualLookup {
|
||||
public:
|
||||
DualLookup();
|
||||
|
||||
struct DualLookupBase {
|
||||
// NOTE(dev): Used to determine which version of the string you want:
|
||||
// 1 / OPPOSITE: The string it maps to, opposite of the one you pass in.
|
||||
// 2 / VALUE: The string passed via the first paramater of 'add.'
|
||||
@@ -17,6 +14,15 @@ public:
|
||||
EQUIVALENT,
|
||||
};
|
||||
|
||||
protected:
|
||||
DualLookupBase() {}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class DualLookup : public DualLookupBase {
|
||||
public:
|
||||
DualLookup();
|
||||
|
||||
/* Add a mapped pair to the container
|
||||
* returns false if it already exists, regardless of direction
|
||||
* (i.e. value->equivilent is a duplicate of equivilent->value)
|
||||
|
||||
Reference in New Issue
Block a user