Boost logo

Boost Users :

Subject: Re: [Boost-users] eval_if fails - problem for C++ guru
From: Tim Song (t.canens.cpp_at_[hidden])
Date: 2015-06-07 12:09:34


On Sun, Jun 7, 2015 at 11:15 AM, Robert Ramey <ramey_at_[hidden]> wrote:

> I also believe that the problem is that is_same is getting invoked "too
> soon". It is for this reason I used eval_if which is intended to avoid
> instantiation of it's arguments but just return the type of the selected
> one.

When you write `typename get_promotion_policy<T>::type`, that's an eager
evaluation, not a lazy one. It doesn't matter what eval_if does, because
`get_promotion_policy` has been invoked before you even get there, to
compute the arguments to `eval_if`.

Clearly I've got something wrong. I tried your code exactly as you've
> written it but I get the same error.

Works for me with both Clang and GCC (
http://coliru.stacked-crooked.com/a/6c3d80d6839ac6e4).

Tim



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net