- Always used for optional dictionary entries, since these are individual
values, and not meant to be embedded in a larger stream of tokens.
Methods:
- lookupOrDefault, lookupOrAddDefault, lookupOrDefaultCompat
- readIfPresent, readIfPresentCompat
- Handling mandatory dictionary entries is slightly more complex,
since these may be part of larger stream of tokens, and are often
used in a constructor context. For example,
word modelType(dict.lookup("type"));
Or they are used without a definite context. For example,
dict.lookup("format") >> outputFormat;
Newly introduced methods for mandatory dictionary entries:
- get, getCompat
- read, readCompat
In a constructor or assignment context:
word modelType(dict.get<word>("type"));
outputFormat = dict.lookup("format");
without copy/move (similar to readIfPresent):
dict.read("format", outputFormat);
- this increases the flexibility of the interface
- Add stringOps 'natural' string sorting comparison.
Digits are sorted in their natural order, which means that
(file10.txt file05.txt file2.txt)
are sorted as
(file2.txt file05.txt file10.txt)
STYLE: consistent naming of template parameters for comparators
- Compare for normal binary predicates
- ListComparePredicate for list compare binary predicates