delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/08/13/10:51:17

From: "Alex Vinokur" <alexvn AT bigfoot DOT com>
Newsgroups: comp.lang.c++,comp.os.msdos.djgpp,gnu.g++.help
Subject: Re: Warning : value_type is implicitly a typename (gcc/gpp-3.1)
Date: Tue, 13 Aug 2002 17:12:59 +0200
Organization: Scopus
Lines: 102
Message-ID: <ajb43s$1a7tuk$1@ID-79865.news.dfncis.de>
References: <aj2vjj$178ktl$1 AT ID-79865 DOT news DOT dfncis DOT de> <Nz759.1526$id3 DOT 59789 AT newsfep2-win DOT server DOT ntli DOT net> <aj4u9j$17mu87$1 AT ID-79865 DOT news DOT dfncis DOT de> <aja19j$19j16h$1 AT ID-79865 DOT news DOT dfncis DOT de> <ajafb5$gv6$8 AT narses DOT hrz DOT tu-chemnitz DOT de>
NNTP-Posting-Host: gateway.scopus.net (62.90.123.5)
X-Trace: fu-berlin.de 1029247932 44300244 62.90.123.5 (16 [79865])
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"André Pönitz" <poenitz AT gmx DOT de> wrote in message news:ajafb5$gv6$8 AT narses DOT hrz DOT tu-chemnitz DOT de...
> Alex Vinokur <alexvn AT bigfoot DOT com> wrote:
> > It seems that using template with typedef below causes warnings.
> > typedef map<AAA, vector<BBB<int> >, less<AAA> > map1_typename;  // No problem with gcc-3.1
>
> > typedef map1_typename::value_type map1_value_type;
>
> Have you tried:
>
>   typedef typename map1_typename::value_type map1_value_type;
>
>           ^^^^^^^^
>
> here?  As silly as it looks, the Standard requires this even if there is
> no ambiguity...
>
> Andre'
>
> --
> Those who desire to give up Freedom in order to gain Security,
> will not have, nor do they deserve, either one. (T. Jefferson)

Andre', thank you.
It helped me.

============
Windows 2000
DJGPP 2.03
gcc/gpp 3.1
============

A code below has no problem with gcc/gpp 3.1


######### C++ code : BEGIN #########

#include <vector>
#include <map>
using namespace std;

// --------------
class AAA {};
bool operator< (const AAA& ins1, const AAA& ins2)
{
  return true;
}

// --------------
template <typename T1>
class BBB {};

// --------------
template <typename T1>
void foo1 ()
{
typedef map<AAA, vector<BBB<int> >, less<AAA> > map1_typename;
typedef map1_typename::value_type map1_value_type;
pair<map1_typename::iterator, bool> pair1_insert;
map1_typename::iterator   map1_pos;


// No problem with gcc-3.1
typedef map<AAA, vector<BBB<T1> >, less<AAA> > map2_typename;
typedef typename map2_typename::value_type map2_value_type;
pair<typename map2_typename::iterator, bool> pair2_insert;
typename map2_typename::iterator   map2_pos;

} // foo1


// --------------
int main ()
{
  return 0;
}

######### C++ code : END ###########

Nevertheless,  there is inequality of rights
    between
typedef map<AAA, vector<BBB<int> >, less<AAA> > map1_typename;
    and
typedef map<AAA, vector<BBB<T1> >, less<AAA> > map2_typename;

map1_typename does NOT require the 'template' word (because of BBB<int> ? )
map2_typename DOES require the 'template' word (because of BBB<T1> ? )

Any explanation ?

====================
  Alex Vinokur
    http://up.to/alexvn
    http://go.to/alexv_math
    mailto:alexvn AT bigfoot DOT com
    mailto:alexvn AT go DOT to
  ====================





- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019