Boost logo

Boost :

Subject: Re: [boost] [multi_index]: Migration of code to VS12 does not compile anymore
From: Sergiu Dotenco (sergiu.dotenco_at_[hidden])
Date: 2014-08-11 11:56:18


On 8/11/2014 5:05 PM, Johannes Brunen wrote:
> Hello,
>
>
>
> I'm porting some code fromVS10 to the VS12 compiler on windows. I have a
> problem compiling code like the following:
>
>
>
> //Test.cpp
>
> #include <boost/multi_index_container.hpp>
>
> #include <boost/multi_index/random_access_index.hpp>
>
> #include <boost/multi_index/hashed_index.hpp>
>
> #include <boost/multi_index/identity.hpp>
>
>
>
> template<typename T>
>
> class test
>
> {
>
> public:
>
> typedef typename boost::multi_index_container <
>
> T*,
>
> boost::multi_index::indexed_by <
>
> boost::multi_index::random_access<>,
>
> boost::multi_index::hashed_non_unique <
> boost::multi_index::identity<T*> >
>
> >
>
> > container_t;
>
>
>
> typedef typename container_t::nth_index<0>::type sequence_index_t;
>
> };
>
>
>
> This does not compile and gives the following error message:
>
>
>
> 1> Test.cpp
>
> 1>D:\test\Test.cpp(18): error C2059: syntax error : '<'
>
> 1> D:\test\Test.cpp(19) : see reference to class template
> instantiation 'test<T>' being compiled
>
> 1>D:\test\Test.cpp(18): error C2238: unexpected token(s) preceding ';'
>
>
>
> I'm unable to find the reason for this error. Is it a compiler error, or
> is something wrong with my declaration?
>
>
>
> Regards,
>
> Johannes

You're missing the template keyword in front of nth_index:

typedef typename container_t::template nth_index<0>::type sequence_index_t;

VC is just being standard compliant here.


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