Skip to content

Implement iterator api #2

Open
Open
@nikhedonia

Description

A Maybe is a container like vector but has either 0 or 1 element.
This would be convenient:

for(auto x : maybe(1) ) {
  std::cout << x << std::endl; // prints 1
} 

for(auto x : maybe<int>() ) {
  //loop not entered
} 

Functional maps should never have sideeffects. For sideeffects this way should be preferred.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions