Boost logo

Boost :

From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2001-06-27 08:59:12


Steve Cleary wrote:
> Last night I converted some code over to use the BOOST_STATIC_CONSTANT
> macro, and ran into a problem: any ICE whose value is determined by a
> template class that takes two or more parameters (*including* the
> metaprogramming helpers provided by <boost/type_traits/ice.hpp>) cannot be
> declared with this macro.
>
> That's a mouthful, so here's an example from "ice_guidelines.htm":
> ::boost::type_traits::ice_or<ICE1,ICE2>::value
> but you can't declare it using BOOST_STATIC_CONSTANT:
> BOOST_STATIC_CONSTANT(bool, val =
> ::boost::type_traits::ice_or<ICE1,ICE2>::value);
> syntax error ^
>
> The problem is that there isn't a way to use an expression
> containing commas as a value for the 'assignment' macro
> argument (wrapping it in parenthesis, the standard way to pass
> commas in macro arguments, will result in a syntax error in this case).

What you need to do is to wrap in parenthesis
"::boost::::type_traits::ice_or<>::value" expression, e.g.

BOOST_STATIC_CONSTANT(bool, val =
(::boost::type_traits::ice_or<ICE1,ICE2>::value));

It's not the fisrt time the question arises, so probably we need to put this
in the paper.

Aleksey


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