diff options
author | Arne Juul <arnej@verizonmedia.com> | 2021-03-03 13:10:19 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2021-03-03 13:10:19 +0000 |
commit | d834dcfc246fed4ceac949de14179ebf97e3bb14 (patch) | |
tree | 036a8d742235f226b5a876c999c658c826cfc4f2 | |
parent | 4488e152b02d73974dd57a7ecd33af4c0e52f307 (diff) |
implement cell_type_from_name in terms of cell_type_to_name
-rw-r--r-- | eval/src/vespa/eval/eval/value_type_spec.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/eval/src/vespa/eval/eval/value_type_spec.cpp b/eval/src/vespa/eval/eval/value_type_spec.cpp index 11067cc5357..470da4f63a3 100644 --- a/eval/src/vespa/eval/eval/value_type_spec.cpp +++ b/eval/src/vespa/eval/eval/value_type_spec.cpp @@ -8,16 +8,6 @@ namespace vespalib::eval::value_type { -std::optional<CellType> cell_type_from_name(const vespalib::string &name) { - if (name == "double") { - return CellType::DOUBLE; - } else if (name == "float") { - return CellType::FLOAT; - } else { - return std::nullopt; - } -} - vespalib::string cell_type_to_name(CellType cell_type) { switch (cell_type) { case CellType::DOUBLE: return "double"; @@ -26,6 +16,15 @@ vespalib::string cell_type_to_name(CellType cell_type) { abort(); } +std::optional<CellType> cell_type_from_name(const vespalib::string &name) { + for (CellType t : CellTypeUtils::list_types()) { + if (name == cell_type_to_name(t)) { + return t; + } + } + return std::nullopt; +} + namespace { class ParseContext |