Re:Modern C++ Features – std::optional
by 0xmaverick on Saturday June 09, 2018 @04:03PM
(#17274710)
I find this useful for older paradigms where you want an error as well as pass in something to fill in as the output. Instead of doing bool foo(OutFoo* out_foo) or overloading Id getId(); // returns -1 if not present. You could use base::Optional<OutFoo> / base::Optional<Id> in each case respectively.
[ Parent
| on HN ]