Motive behind !empty() with front() instead of Optional front()

Paul Backus snarwin at gmail.com
Mon Apr 5 20:11:07 UTC 2021


On Monday, 5 April 2021 at 20:01:46 UTC, Per Nordlöw wrote:
> On Wednesday, 31 March 2021 at 07:27:18 UTC, Jacob Carlborg 
> wrote:
> way to interact with an Optional type
>> is not to use pattern matching but to use algorithms like 
>> `map`, `each` and so on.
>
> Interesting. Can you show some pseudocode of this? Can those 
> algorithms be implemented as non-member functions?

The `optional` package on dub [1] has some examples in its 
documentation.

[1] https://code.dlang.org/packages/optional


More information about the Digitalmars-d mailing list