473,396 Members | 2,020 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,396 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 2023
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.