Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I try to compile a legacy project from here on this website. it is in old style of C++ template before 2003.

it is a straight definition, but I got many errors and the first error is:
Error	C2238	unexpected token(s) preceding ';'


the template class definition is below:

C++
template<typename T, typename TListX, typename TListY, typename TPointContainer>
class TKeyDoubleContainer
{
public:
	typedef TPointContainer::const_iterator value_type;//<=== error happens on this line
	typedef TListX container_x;
	typedef TListY container_y;

	TKeyDoubleContainer( container_x* pListX = NULL, container_y* pListY = NULL):m_pListX(pListX), m_pListY(pListY){};

//skips many lines here
};


What I have tried:

I suspect the problem is in the parameter :typename TPointContainer.
just as a typename, it assumes it has const_iterator type.

it is an old style declartion before 2003, but I can not figure it out quickly how to refactor this piece...

Thanks a million!
Posted
Updated 7-Apr-21 7:41am
v2

g++ tells
error: need ‘typename’ before ‘T::abc’ because ‘T’ is a dependent scope
  typedef T::abc local_type;


You might want to turn the time back and compile with the matching C++ standard setting on your compiler. E.g. for g++, there is a command line argument -std=... where you can indicate the C++ standard to take for compiling your sources.
 
Share this answer
 
v2
Comments
Southmountain 2-Apr-21 19:09pm    
your g++ message helps me to figure it out what's going on....
this link answered this question.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900