Boost logo

Boost :

From: Toon Knapen (toon.knapen_at_[hidden])
Date: 2004-07-12 06:37:54


John Maddock wrote:

>>I wonder if it's possible to use preprocessor tricks to have
>>BOOST_STATIC_CONSTANT generate enums (on IBM only) whenever they will
>>fit? After all, integral constants _can_ be managed by the
>>preprocessor.
>
>
> So they can, but not with BOOST_STATIC_CONSTANT as is:
>
> BOOST_STATIC_CONSTANT(long long, value = 0ULL);
>
> as far as I know there's no way to do different things depending upon the
> second argument here, but I'd love to be proved wrong (and be very impressed
> as well!).

We already have BOOST_WORKAROUND. What I can do is provide a
BOOST_WORKAROUND that will use an enum if the datatype is not too wide.
Simple but effective!

historical note: The reason I brought this up was because Mathias Troyer
  asked me to remove the BOOST_NO_INCLASS_MEMBER_INITIALIZATION in the
config for vacpp version 6. And indeed, vacpp can handle the
initialization but does not comply with the DR (so one can argue if
BOOST_NO_INCLASS_MEMBER_INITALIZATION should be defined or not).
Defining it however caused a problem in the random library however
(Mathias can you recall what exactly happened and why).

Next, should'nt it be a good idea to mention the policy on the out of
line definition on http://www.boost.org/more/int_const_guidelines.htm
(I'm willing to do it but a language lawyer among us should probably
best revise it before I commit it).


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