Boost logo

Boost :

Subject: Re: [boost] [hana] some notes, not a review
From: David Stone (david_at_[hidden])
Date: 2015-06-20 00:15:52


On Fri, Jun 19, 2015 at 2:40 AM, Mathias Gaunard <
mathias.gaunard_at_[hidden]> wrote:

> What template meta-programming were you able to replace by constexpr?
>
> As far as I'm concerned, I've yet to see a use case where constexpr is
> anything but an optimization hint.
>

All of the calculation for new bounds of my bounded::integer library use
constexpr computation. The result of these constexpr computations will be
used as template parameters (so the value computations in my constexpr
functions will be used to determine a template type). The entire contents of

https://bitbucket.org/davidstone/bounded_integer/src/51e8369077e4765136e07181ddb433cee6f25eaa/bounded_integer/detail/arithmetic?at=default

show this, especially

https://bitbucket.org/davidstone/bounded_integer/src/51e8369077e4765136e07181ddb433cee6f25eaa/bounded_integer/detail/arithmetic/modulus.hpp?at=default

What I am currently working on with this will make it especially difficult
to replace this with non-type template parameters for a more C++03
metaprogramming style, because the template parameters to my constexpr
functions will themselves be bounded::integer types, which are not allowed
as non-type template parameters.


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