Last active
May 31, 2017 15:11
-
-
Save njlr/2bb6a5e9d1c44d65ba5141b7be7e424d to your computer and use it in GitHub Desktop.
This file contains hidden or 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 L, class R> | |
auto fold(L l, R r) { | |
using lTag = typename L::tag; | |
using rTag = typename R::tag; | |
if constexpr (is_base_of<rTag, BarTag>::value) { | |
if constexpr (is_same<lTag, FooTag>::value) { | |
return foldFB(l, r); | |
} else { | |
return foldBB(l, r); | |
} | |
} else { | |
return foldFF(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment