Boost logo

Boost :

From: John Maddock (jm_at_[hidden])
Date: 2003-02-14 08:00:13


> Several of the boost libraries select functionality based on the result
> of some compile-time test. The result is usually stored in a
> BOOST_STATIC_CONST( bool, test::value );
>
> The current Borland compiler does not allow these values to be used as
> template parameters though.
>
> I suggest a new config macro
>
> BOOST_NO_STATIC_CONST_AS_TEMPLATE_PARAM
> and if this is defined the metafunction result is passed directly into
> the template parameter

We could, but part of the guideline for integral constant expressions, is
don't do that :-)

> eg: [from lambda_traits]
>
> #if defined( BOOST_NO_STATIC_CONST_AS_TEPLATE_PARAM )
> typedef
> action<
> boost::tuples::length<args_t>::value,
> function_action< boost::tuples::length<args_t>::value >
> > action_type;
> #else
> BOOST_STATIC_CONSTANT(int, nof_elems =
> boost::tuples::length<args_t>::value);
>
> typedef
> action<
> nof_elems,
> function_action<nof_elems>
> > action_type;
> #endif
>
>
> I am not sure if any other compilers would benefit from such a macro,
> nor if this is misbehaviour is new to v6

Probably it might be just as well to use BOOST_WORKAROUND for this ?

John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/index.htm


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