Boost logo

Boost :

Subject: Re: [boost] New library proposal: Autodiff
From: Matt Pulver (mpulver_at_[hidden])
Date: 2018-12-20 01:15:07

On Wed, Dec 19, 2018 at 3:40 PM Marc Glisse via Boost <boost_at_[hidden]>

> Don't underestimate the importance of keeping the author of the library
> motivated. If supporting crappy old tools makes them lose the will to keep
> improving the library, we end up with one more unmaintained boost
> package...
Thank you for articulating this point. In fact I wrote a closed-source
C++11 version of this library a few years ago with all the SFINAE code as
well as Windows and Linux-specific hacks due to slight differences in how
the compilers interpreted the obscure SFINAE code. Though it worked, I was
not happy with how much I had to butcher the project and additional changes
started to become increasingly difficult. It is due to the new C++17
compile-time logic that provides the opportunity to "do it right" and I am
happy with how much cleaner and maintainable this new version is.

On Wed, Dec 19, 2018 at 3:44 PM Peter Dimov via Boost <boost_at_[hidden]>

> In the specific case of
> as far as I can see you can just drop the `constexpr` part from `if
> constexpr` on pre-17 compilers and everything would work. But that's just
> from a quick glance, I haven't tried it.

For example, the following will not compile with pre-17 compilers if
`constexpr` is dropped:

template<typename RealType,size_t Order>
constexpr size_t dimension<RealType,Order>::depth()
    if constexpr (is_dimension<RealType>::value)
        return 1 + RealType::depth();
        return 1;

There are cases where RealType can be a fundamental type, such as double.
In this case, RealType::depth() will give a compiler error.


Boost list run by bdawes at, gregod at, cpdaniel at, john at