ENH: align Enum methods with HashTable

- deprecate get(key, deflt) in favour of lookup(key, deflt).
  Method name compatibility with HashTable.

- deprecate operator().
  The meaning is too opaque and equally served by other means:

  - use get(key) instead of operator()(key).
    Const access whereas HashTable::operator()(key)
    creates missing entry.

  - lookup(key, deflt) - instead of operator()(key, deflt).
    Const access whereas HashTable::operator()(key, deflt)
    creates a missing entry.

- make Enum iterable to allow participation in range-for etc.
This commit is contained in:
Mark Olesen
2020-11-20 00:32:28 +01:00
parent 9122713b37
commit d2f1690536
13 changed files with 242 additions and 117 deletions

View File

@ -80,7 +80,7 @@ static enum Time::stopAtControls getStopAction(const std::string& filename)
const word actionName(word::validate(fileContent.substr(equals+1)));
return
Time::stopAtControlNames
Time::stopAtControlNames.lookup
(
actionName,
Time::stopAtControls::saUnknown