Boost logo

Boost :

Subject: Re: [boost] Yap's formal review is starting now!
From: Peter Dimov (lists_at_[hidden])
Date: 2018-02-17 19:50:27


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 <boost::yap::expr_kind Kind, typename... Arg>
    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. :-)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk