From 04bb8ab51d9cc6b5256143fc1f3f6350e6e256ca Mon Sep 17 00:00:00 2001 From: Ilya Churaev Date: Mon, 25 May 2020 16:23:55 +0300 Subject: [PATCH] Added case less check for enum names (#534) * Added case less check for enum names * Added header --- ngraph/src/ngraph/enum_names.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ngraph/src/ngraph/enum_names.hpp b/ngraph/src/ngraph/enum_names.hpp index 805e84e..5da4e2c 100644 --- a/ngraph/src/ngraph/enum_names.hpp +++ b/ngraph/src/ngraph/enum_names.hpp @@ -16,6 +16,7 @@ #pragma once +#include #include #include @@ -32,9 +33,15 @@ namespace ngraph /// Converts strings to enum values static EnumType as_enum(const std::string& name) { + auto to_lower = [](const std::string& s) + { + std::string rc = s; + std::transform(rc.begin(), rc.end(), rc.begin(), ::tolower); + return rc; + }; for (auto p : get().m_string_enums) { - if (p.first == name) + if (to_lower(p.first) == to_lower(name)) { return p.second; } -- 2.7.4