Zach Laine wrote:
Anyway, I can't get the compiler to treat the result of get_arity as a
constant expression using std::max, even in C++17 mode with a recent-ish
Clang, so I'm leaving the example as-is for now.
Yes, unfortunately, the straightforward way doesn't work. This does:
template
auto operator() (boost::yap::expr_tag<Kind>, Arg &&... arg)
{
auto constexpr r = std::max( {
decltype(
boost::yap::transform(
boost::yap::as_expr(std::forward<Arg>(arg)), get_arity{}
)
)::value... } );
return boost::hana::llong<r>{};
}
And you're right, it works even with -std=c++14.
Whether this is really an improvement over what we started with is
questionable. :-)