diff --git a/main.cpp b/main.cpp index 85592ae..5cef11e 100644 --- a/main.cpp +++ b/main.cpp @@ -33,6 +33,9 @@ bool checkNumeric(std::string *firstNum, std::string *secondNum); template bool key_exists(const T &container, const Key &key); +template +bool findByValue(std::map mapOfElemen, Value value); + void printHelp(); int main(int argc, char **argv) { @@ -283,6 +286,18 @@ bool key_exists(const T &container, const Key &key) { return container.find(key) != end(container); } +template +bool findByValue(std::map mapOfElemen, Value value) { + auto iterator = mapOfElemen.begin(); + while (iterator != mapOfElemen.end()) { + if (iterator->second == value) { + return true; + } + } + + return false; +} + void printHelp() { cout << "Usage: Program PATH [OPTION] < [FILE] ...\n" " or: Program PATH [OPTION] file name\n"