Created
April 8, 2015 12:37
-
-
Save akhileshs/466358e84315451ff7bb to your computer and use it in GitHub Desktop.
option type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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