Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<class A, class B>
- optional<B> try(optional<A> a, function< optional<B>(A) > fn){
- if ( !a.has_value ){
- return nullopt;
- }
- return fn(a.value);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement