Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.16 KB | None | 0 0
  1. template<class A, class B>
  2. optional<B> try(optional<A> a, function< optional<B>(A) > fn){
  3. if ( !a.has_value ){
  4. return nullopt;
  5. }
  6. return fn(a.value);
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement