Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@picanumber
Last active March 20, 2016 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save picanumber/291e059221987c2b4d15 to your computer and use it in GitHub Desktop.
Save picanumber/291e059221987c2b4d15 to your computer and use it in GitHub Desktop.
struct Max
{
template <class T1, class T2>
constexpr decltype(auto) operator()(T1&& lhs, T2&& rhs)
{
return lhs > rhs ? std::forward<T1>(lhs) : std::forward<T2>(rhs);
}
};
int main()
{
static_assert(20 == fld::foldl<Max>(1, 20, 3, 5), "ET phone home");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment