473,385 Members | 1,429 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,385 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 2022
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 {...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?

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.