delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/03/18/18:17:18

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Message-ID: <405A2B70.80800@phekda.gotadsl.co.uk>
Date: Thu, 18 Mar 2004 23:06:24 +0000
From: Richard Dawe <ng AT phekda DOT gotadsl DOT co DOT uk>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031031
X-Accept-Language: en, de, fr
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: iterator depricated warning
References: <20040317173307 DOT 02207 DOT 00001634 AT mb-m19 DOT aol DOT com>
In-Reply-To: <20040317173307.02207.00001634@mb-m19.aol.com>
Lines: 52
NNTP-Posting-Host: 81.6.221.44
X-Trace: 1079651168 mercury.nildram.net 55915 81.6.221.44
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello.

DanG2015 wrote:
> I'm sure there's a simple answer to this, but I can't find it.
> 
> The code:========================
> 
> #include <deque>
> 
> template <class T>
> class foo {
> 
> public:
>     std::deque<T>   foo_deque;
> 
>     void foo_method( void ) {
>         std::deque<T>::iterator i = foo_deque.begin();
>     }
> };
> 
> int main( void ) {
> }
> 
> the compile=========================
> 
> C:> gpp -Wall test.cpp
> test.cpp: In member function `void foo<T>::foo_method()':
> test.cpp:10: warning: `typename std::deque<T, std::allocator<_CharT>
> 
>>::iterator' is implicitly a typename
> 
> test.cpp:10: warning: implicit typename is deprecated, please see the
> documentation for details
[snip]

I've seen this before. At a guess:

std::deque<> takes a type name, e.g.: int or SomeClass. You need to get 
the type name from the template parameter. E.g.:

   std::deque<typename T>   foo_deque;

and:

   std::deque<typename T>::iterator i = foo_deque.begin();

I guess that implicit typenames are not supported, to remove ambiguity. 
Consider the clash between a template parameter T and a type called T. 
I'm just guessing - I don't have my copy of Stroustrop here.

Bye, Rich =]

- Raw text -


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