Boost logo

Boost Users :

Subject: Re: [Boost-users] puzzle with enable_if
From: John Dlugosz (JDlugosz_at_[hidden])
Date: 2010-04-15 15:34:49


>
> Move the integral constant type you are deriving from to the template
> parameter list for SFINAE to apply. In this case that'll be:
>
> ...
> Please let me know if this works for you.
>

That looks a lot cleaner than what I feared, breaking it into helper classes. I'll try it.
But I can't help but wonder why the bottom one (direct use of enable_if) does work. It looks like the code is pretty much the same as what I what I wrote.

>
> BTW, has my suggestion in the thread "Choosing a variable size" worked
> for you?

Nothing has "worked", since it turns out that I have to worry about the range of the intermediate result being beyond what the final thing will hold, so might need to be larger. It would be great to get the whole function down to template metaprogramming, but that won't happen any time soon. For now, I'll look at optimizing particular cases if/when it turns out to be an issue on 32-bit builds, and my real problem (with just using the largest size) is dealing with signed vs. unsigned for that largest integer.

--John





TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.


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