Boost logo

Boost :

From: scleary_at_[hidden]
Date: 2001-06-27 08:48:21

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":
but you can't declare it using BOOST_STATIC_CONSTANT:
                                                        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).

This makes two of the guidelines in "ice_guidelines.htm" mutually exclusive.


I recall a little debate a while back over an alternate implementation:
 # define BOOST_STATIC_CONSTANT(type, name, value) enum { name = value }
 # define BOOST_STATIC_CONSTANT(type, name, value) static const type name =
which would resolve this issue. That debate was actually about 'name =
value' vs. 'name, value' which I don't really care about; but now this
affects functionality.

OR we can just say that this is an "uncommon occurrence" (it's only used in
non-type template metaprogramming), and let those "uncommon" <wink> people

Dave, what do you think? Make sweeping change or just declare it uncommon?


Boost list run by bdawes at, gregod at, cpdaniel at, john at