aboutsummaryrefslogtreecommitdiff
path: root/lib/omittable.h
AgeCommit message (Collapse)Author
2022-10-02Relax Omittable::operator->/operator*Alexey Rusakov
The imposed limitations made mutation of Omittables pretty much impossible outside of rvalues. Honestly, it was pretty much the original intention - and it doesn't look right, in retrospect. (cherry picked from commit 7f886b34936f324662eb17afbb214d4800dcea03)
2022-01-23Omittable: split out from util.h and refreshAlexey Rusakov
Improvements: - Quotient::lift() - a way to invoke a function on an optional (including Omittable) or a pointer if it's 'truthy'. Doesn't need enhanced function_traits<>, only the standard library; works on any number of arguments that can be dereferenced and casted to bool. - then() - the version of lift() as a member function. - edit() was renamed to ensure() (edit() might become a read-write counterpart of then() at some point). It's not really used across libQuotient codebase (or elsewhere) but is staying there just in case. It can also accept an initializer, removing the requirement of default-constructibility. - Quotient::merge() is simplified, with one universal implementation covering both Omittable/optional and plain values. - All that now lives in its dedicated pair of files, further decluttering util.h