: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/usieve/stoopidsimple.com/includes/common.inc on line 1782.
: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/usieve/stoopidsimple.com/includes/common.inc on line 1782.
typename + g++ 3.4.x | stoopidsimple.com

typename + g++ 3.4.x

salem | 2005-08-13 02:19

Typename is such a pain...
I recently upgraded to g++ 3.4.x and it demands proper use of "typename".
This artical describes the problem and offers a solution.

Here is some example code:

#include 

template
class bar {
        typedef std::vector<_foo> vect_t;
        vect_t::iterator itr;
};

The problem is that the compiler cannot decide what vect_t::iterator is.

g++ will complain:

test1.cc:6: warning: `std::vector<_foo, std::allocator<_CharT> >::iterator' is
   implicitly a typename
test1.cc:6: warning: implicit typename is deprecated, please see the
   documentation for details

To let the compiler know that vect_t::iterator is a type name and not a data member or something else you must use the typename keyword:

#include 

template
class bar {
        typedef std::vector<_foo> vect_t;
        typename vect_t::iterator itr;
};

Lfhex

Tonality

User login

Navigation

PHP

Kccmp

Java

Homestar

Slashdot


Advertisement