diff --git a/DualLookup.h b/DualLookup.h index 4015dfe..73cf91f 100644 --- a/DualLookup.h +++ b/DualLookup.h @@ -2,11 +2,8 @@ #define DVEREB_DUALLOOKUP_H #include -template -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 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) diff --git a/main.cpp b/main.cpp index 240b74a..a4de7a2 100644 --- a/main.cpp +++ b/main.cpp @@ -65,13 +65,13 @@ TEST_CASE("all tests", "all") { REQUIRE(container.get(1, container_result)); CHECK(container_result == 2); container_result = 0; - REQUIRE(container.get(1, container_result, DualLookup::Type::OPPOSITE)); + REQUIRE(container.get(1, container_result, DualLookupBase::Type::OPPOSITE)); CHECK(container_result == 2); container_result = 0; - REQUIRE(container.get(1, container_result, DualLookup::Type::EQUIVALENT)); + REQUIRE(container.get(1, container_result, DualLookupBase::Type::EQUIVALENT)); CHECK(container_result == 2); container_result = 0; - REQUIRE(container.get(1, container_result, DualLookup::Type::VALUE)); + REQUIRE(container.get(1, container_result, DualLookupBase::Type::VALUE)); CHECK(container_result == 1); container_result = 0;