Skip to content

Instantly share code, notes, and snippets.

@akhileshs
Created April 8, 2015 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akhileshs/466358e84315451ff7bb to your computer and use it in GitHub Desktop.
Save akhileshs/466358e84315451ff7bb to your computer and use it in GitHub Desktop.
option type
template <class A>
class Option {
bool isValid;
A value;
public:
Option() : isValid(false) {}
Option(A v) : isValid(true), value(v) {}
bool isValid() const { return isValid; }
A value() const { return value; }
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment