Operating System - HP-UX
1834144 Members
2266 Online
110064 Solutions
New Discussion

Re: aCC iterator-in-a-namespace problem

 
Allan Stirrett
Occasional Advisor

aCC iterator-in-a-namespace problem

Hi,

I'm now trying to port our Win32/Linux/Solaris code to HP-UX 11i using aCC version 03.30. I hit a roadblock that I THOUGHT was an STLport problem, but appears to be more aCC-related, since I get the same error building with the built-in Rogue Wave STL.

The attached source code demonstrates what I've run into: When I declare a new class inside a namespace, then try to add an iterator inside that class in the namespace, I get the following compile errors:

aCC -o testiter2 testiter2.cpp
Error 419: "testiter2.cpp", line 10 # 'iterator' is used as a type, but has not been defined as a type.
map<_Key, _Tp>::iterator m_Iterator;
^^^^^^^^
Error 502: "testiter2.cpp", line 10 # Attempt to access 'map::' is invalid; '' is not a member of 'map' or any base class.
map<_Key, _Tp>::iterator m_Iterator;
^^^^^^^^^^
Error (future) 642: "testiter2.cpp", line 10 # The 'typename' keyword is required if '' is to be used as a type since the qualifier depends on template type parameters.
map<_Key, _Tp>::iterator m_Iterator;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Any ideas?

While I'm at it, I had a question about std::. The compiler doesn't like me using std:: inside the "mine" namespace. Why would that be? If I want to put an std::map inside my mine::map, I don't think that's currently possible. Am I missing something somewhere?

Thanks in advance for any hints/tips/solutions.

Allan Stirrett.
2 REPLIES 2
Allan Stirrett
Occasional Advisor

Re: aCC iterator-in-a-namespace problem

P.S. I've now discovered you get the same result withOUT the "namespace mine" around the code (just change the name of the new "map" class to something different--see the attached updated source).
Allan Stirrett
Occasional Advisor

Re: aCC iterator-in-a-namespace problem

P.P.S. I found the -AA compiler option for aCC which enables the newer, std-namespace-enabled STL, so please ignore the last part of my first post. Thank you.