473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Compiler warning regarding type definition

DFP
I am posting the gcc 3.3.2 compiler error and the source lines below
them. Please explain this warning and how to fix it.

crt/crtmap.hpp:17: warning: `std::map<K, D, C,
std::allocator<std::pair<const
_Key, _Tp> > >::iterator' is implicitly a typename
crt/crtmap.hpp:17: warning: implicit typename is deprecated, please see the
documentation for details
crt/crtmap.hpp:18: warning: `std::map<K, D, C,
std::allocator<std::pair<const
_Key, _Tp> > >::const_iterator' is implicitly a typename
crt/crtmap.hpp:18: warning: implicit typename is deprecated, please see the
documentation for details

----------------

Here is the offending code:

template <class K,class D,class C>
class CRTMap
{

private:
mutable std::map<K,D,C> mymap;
mutable CRTMLock MLock;

public:
typedef std::map<K,D,C>::iterator iterator; //// Line 17
typedef std::map<K,D,C>::const_iterator const_iterator; //// Line 18

inline CRTMap(void)
{
}

[...]

Jul 22 '05 #1
4 2024
On Sat, 03 Apr 2004 22:24:08 -0500, DFP <DF*@nospam.net> wrote:
I am posting the gcc 3.3.2 compiler error and the source lines below
them. Please explain this warning and how to fix it.
Isn't this in the FAQ yet? :-)

crt/crtmap.hpp:17: warning: `std::map<K, D, C,
std::allocator<std::pair<const
_Key, _Tp> > >::iterator' is implicitly a typename
crt/crtmap.hpp:17: warning: implicit typename is deprecated, please see the
documentation for details
crt/crtmap.hpp:18: warning: `std::map<K, D, C,
std::allocator<std::pair<const
_Key, _Tp> > >::const_iterator' is implicitly a typename
crt/crtmap.hpp:18: warning: implicit typename is deprecated, please see the
documentation for details

----------------

Here is the offending code:

template <class K,class D,class C>
class CRTMap
{

private:
mutable std::map<K,D,C> mymap;
mutable CRTMLock MLock;

public:
typedef std::map<K,D,C>::iterator iterator; //// Line 17 typedef typename std::map<K,D,C>::iterator iterator;
typedef std::map<K,D,C>::const_iterator const_iterator; //// Line 18

typedef typename std::map<K,D,C>::const_iterator const_iterator;

ISO C++ requires type names (as opposed to other kinds of names) dependent
upon a template parameter to be qualified with the keyword "typename". Some
compilers make do without the 'typename', although the code is not
compliant without it.
-leor

--
Leor Zolman --- BD Software --- www.bdsoft.com
On-Site Training in C/C++, Java, Perl and Unix
C++ users: Download BD Software's free STL Error Message Decryptor at:
www.bdsoft.com/tools/stlfilt.html
Jul 22 '05 #2
On Sat, 03 Apr 2004 22:24:08 -0500, DFP <DF*@nospam.net> wrote:
I am posting the gcc 3.3.2 compiler error and the source lines below
them. Please explain this warning and how to fix it.
Isn't this in the FAQ yet? :-)

crt/crtmap.hpp:17: warning: `std::map<K, D, C,
std::allocator<std::pair<const
_Key, _Tp> > >::iterator' is implicitly a typename
crt/crtmap.hpp:17: warning: implicit typename is deprecated, please see the
documentation for details
crt/crtmap.hpp:18: warning: `std::map<K, D, C,
std::allocator<std::pair<const
_Key, _Tp> > >::const_iterator' is implicitly a typename
crt/crtmap.hpp:18: warning: implicit typename is deprecated, please see the
documentation for details

----------------

Here is the offending code:

template <class K,class D,class C>
class CRTMap
{

private:
mutable std::map<K,D,C> mymap;
mutable CRTMLock MLock;

public:
typedef std::map<K,D,C>::iterator iterator; //// Line 17 typedef typename std::map<K,D,C>::iterator iterator;
typedef std::map<K,D,C>::const_iterator const_iterator; //// Line 18

typedef typename std::map<K,D,C>::const_iterator const_iterator;

ISO C++ requires type names (as opposed to other kinds of names) dependent
upon a template parameter to be qualified with the keyword "typename". Some
compilers make do without the 'typename', although the code is not
compliant without it.
-leor

--
Leor Zolman --- BD Software --- www.bdsoft.com
On-Site Training in C/C++, Java, Perl and Unix
C++ users: Download BD Software's free STL Error Message Decryptor at:
www.bdsoft.com/tools/stlfilt.html
Jul 22 '05 #3
DFP wrote:
typedef std::map<K,D,C>::iterator iterator; //// Line 17
typedef std::map<K,D,C>::const_iterator const_iterator; //// Line 18


"//" is sufficient to mark a comment in C++.

typedef typename std::map<K,D,C>::iterator iterator;
typedef typename std::map<K,D,C>::const_iterator const_iterator;

The rule is that std::map<K,D,C>::iterator is assumed to be the name of
an object unless you say that it's the name of a type.

--

Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)
Jul 22 '05 #4
DFP wrote:
typedef std::map<K,D,C>::iterator iterator; //// Line 17
typedef std::map<K,D,C>::const_iterator const_iterator; //// Line 18


"//" is sufficient to mark a comment in C++.

typedef typename std::map<K,D,C>::iterator iterator;
typedef typename std::map<K,D,C>::const_iterator const_iterator;

The rule is that std::map<K,D,C>::iterator is assumed to be the name of
an object unless you say that it's the name of a type.

--

Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)
Jul 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: qazmlp | last post by:
When I compile my C++ source code, I am getting hundreds of following warning. "/opt/SUNWspro/WS6U1/include/CC/Cstd/./ios", line 148: Warning: std::basic_ios<char, std::char_traits<char>>::copyfmt...
2
by: DFP | last post by:
I am posting the gcc 3.3.2 compiler error and the source lines below them. Please explain this warning and how to fix it. crt/crtmap.hpp:17: warning: `std::map<K, D, C,...
8
by: Chul Min Kim | last post by:
Hi, I got a BUS ERROR from one of my company's program. Let me briefly tell our environment. Machine : Sun E3500 (Ultra Sparc II 400Mhz CPU 4EA) OS : Solaris7 Compiler : Sun Workshop...
5
by: Robert A Riedel | last post by:
I have a class that is intended to be exported in a DLL that uses another class that is in a static library. All clients that use the DLL will also link with the same static library. In summary,...
5
by: Ondrej Spanel | last post by:
I though that inline functions should be always visible only in the compilation unit where they are defined - meaning if compiler cannot inline them, they should be handled as if declared static....
17
by: Michael Reichenbach | last post by:
Here is the example code. int main(int argc, char *argv) { string Result; WIN32_FIND_DATA daten; HANDLE h = FindFirstFile(TEXT("c://test"), &daten); system("PAUSE"); return EXIT_SUCCESS; }
92
by: Heinrich Pumpernickel | last post by:
what does this warning mean ? #include <stdio.h> int main() { long l = 100; printf("l is %li\n", l * 10L);
1
by: dewi | last post by:
Dear All, I am trying to compile a C code using Visual C++. Can anyone explain how to solve it? Thank You. #include <math.h> #include <string.h> #include "RV2AJFRONT_NEW.h" #include...
6
by: James H. Newman | last post by:
I am playing with some code that has been automatically generated from ASN.1 data specification found in RFC 3280. One of the structures generated reads as follows: typedef struct TBSCertList {...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.