E3SM-Project / E3SM-Project/EKAT

Change default internal storage of arrays in ParameterList, when parsing a YAML file

Open
#190 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
22
Forks
12
PR merge metrics
No merged PRs in 30d

Description

Having different storage for values and sequences when it comes to bool is annoying, also from the code complexity point of view.

As of today, our YAML parser stores arrays of bool as `std::vector`. PR #189 changes that into `std::vector`, so that we can tell a true array of ints from an array that is used to store bools. This, however, does not solve the asymmetry between "list of supported value types" and "list of supported sequence types".

One solution could be to store arrays as `std::deque`, which is technically not an array, but it is still indexable via `operator[]` (which is likely all that a user needs). This would make parsing/writing/storing an array of T implementable as a for loop wrapping the parsing/writing/storing of individual T values.

This would be a NON backward compatible solution, since all `p.get>(pname)` calls will have to be changed. We could hope to implement a deprecated specialization for `get>`, so that old code can still work while the deprecated interface is there. But that interface would require some dark magic hack to provide a (const) ref to a vector without actually storing one.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.