Boost logo

Boost :

Subject: Re: [boost] [scope_exit] C++11 freely uses typename (on MSVC10?)
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2012-04-02 18:19:34


Le 02/04/12 22:04, lcaminiti a écrit :
> Nelson, Erik - 2 wrote
>> Lcaminiti wrote on Monday, April 02, 2012 1:53 PM
>>
>>> For example, is the following supposed to compile on MSVC10?
>>> #include<boost/mpl/identity.hpp>
>>>
>>> int main() {
>>> typedef typename boost::mpl::identity<int>::type t;
>>> t i = 0;
>>> return i;
>>> }
>> This code does not compile on my copy of MSVC10.
>>
>> -->error C2899: typename cannot be used outside a template declaration
>>
> Thanks. Is anyone positive about what the C++11 standard says in this case?
> This code compiles on my GCC 4.5.3 with -std=c++0x... who's right MSVC or
> GCC?
>
>
I don't know what the c++11 standard says, but as there are some
compilers that don't support it and this was not allowed on C++03
compilers you should live with this constraint and the use of typename
outside templates.

Best,
Vicente


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