Guest User

Untitled

a guest
Jan 17th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. optional<int> func1() {
  2. if (int num = rand() < 42) {
  3. return num;
  4. }
  5. return {};
  6. }
  7.  
  8. optional<int> func2() {
  9. optional<int> val = func1();
  10. if (!val) {
  11. return {};
  12. }
  13.  
  14. int num = val.value();
  15. ...
  16. }
  17.  
  18. int val = optional_check(func2());
Add Comment
Please, Sign In to add comment