Boost logo

Boost :

Subject: Re: [boost] [config] local types as template params
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2012-01-05 13:00:45


On 01/02/2012 10:58 AM, Lorenzo Caminiti wrote:
> Hello all,
>
> Is it possible to add a macro
> BOOST_CONFIG_LOCAL_TYPES_AS_TEMPLATE_PARAMS to Boost.Config to
> indicate if local types can be passed as template parameters?
>
> 1) Boost.Closure (formerly, Boost.Local) implements some optimizations
> when local types can be passed as template parameters.
> 2) C++11 always allows to pass local types as template parameters.
> 3) Local types cannot be passed as template parameters on C++03
> instead but some C++03 compilers MSVC 8 (and older?) allow it anyway.
>
> // If it is possible to pass local types (classes, etc) as template parameters.
> // This is not possible in pure C++03 but it is possible in some C++03
> // extensions (MSVC 8.0) and with C++11 (GCC>= 4.5.x -std=c++0x).
> #if (__GNUC__> 4 || (__GNUC__ == 4&& __GNUC_MINOR__> 4))&& \
> defined(__GXX_EXPERIMENTAL_CXX0X__)
> // From GCC 4.5.x when -std=c++0x specified.
> # define BOOST_LOCAL_TYPES_AS_TEMPLATE_PARAMS
> #elif defined(_MSC_VER)
> // For (all?) MSVC (tested on MVSC 8.0).
> # define BOOST_LOCAL_TYPES_AS_TEMPLATE_PARAMS
> #endif

Boost.Config is not organized like that, it's per compiler.
the name should also be BOOST_NO_LOCAL_TYPES_AS_TEMPLATE_PARAMS.

Finally this seems incomplete, local types as template params used to
work in C++03 with older versions of GCC too.
It does indeed work for all versions of MSVC AFAIK.


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