|
Boost : |
From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2001-02-07 09:36:46
John Maddock wrote:
> 3) There are problem handling integral constant expressions, in particular
> you must refer to integral constant expressions by their fully qualified
> names, otherwise they are not recognised as such (I've sporadically had
> this problem with VC6 as well).
Same with me. I've run across several ones just a few days ago, but as I have
seen type traits library's workaround, I just adopted the same approach.
> Also look at the new type traits stuff, there is some integral constant
> expression stuff in there that I havn't got around to documenting yet - see
> boost/type_traits/ice.hpp - these are used extensively inside the new type
> traits code, where all logical operators have been abolished. Maybe this
> shouls be moved out of the type_traits library into it's own "top level"
> header, I'm not sure.
I think it should; at least I use pretty much the same technique, and I hate
repeating code :). BTW, another candidate for refactoring, or, more
specifically, for moving to 'boost/config.hpp' is BOOST_DECL_MC macro, also
from the 'type_traits/ice.hpp' header. 'MC' stands for Member Constant, IIUC,
and the usage is pretty obvious:
template<> struct is_volatile<void> {
BOOST_DECL_MC(bool, value, false);
};
I don't like the name much, though ;). My version is called
BOOST_MPL_STATIC_CONSTANT (MPL is library specific prefix), and it has only
two arguments (so the above declaration would look as
BOOST_MPL_STATIC_CONSTANT(bool, value = false) ), but these are details.
--Aleksey
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk