September 19, 2003

implicit typename is deprecated

Oh man, Stanford just updated it's gcc and gcc libraries - and now my precious code won't compile. Seems like it'll be a nightmare to sort out. I made some headway adding 'using namespace std;' right after the included files. But what is this 'implicit typename is deprecated'. I found a hint here. When getting the type of object T inside of container using value_type, e.g., valarray::value_type, the term 'typename' needs to go in front of the declaration, i.e., typename valarray::value_type. So, if before I had:

copy(&data[0],&data[0]+data.size(),ostream_iterator< valarray::value_type >(s," "));
Now I should have:
copy(&data[0],&data[0]+data.size(),ostream_iterator< typename valarray::value_type >(s," "));
Hmmm, this is also a problem with iterators. You need to preface iterators with typename. Note that use of the term 'typename' is for when one is using templates.

Posted by torque at September 19, 2003 11:31 AM | TrackBack
Comments

huzzah! i've been looking for a solution to that error, and adding `typename' fixes it, thanks :))

Posted by: morbid at July 9, 2004 9:58 AM

But how the hell do you define a iter? Adding the above just breaks the code more!

It's pretty sad that the reason millions of pages of code around the world will no longer compile is that somone with more power then work ethic and morality decided he was going to be a lazy bastard and break a perfectly decent compiler.

To make it worse you cant find tutorials on how to fix this anywhere, all anyone does is point back to that newsgroup post.

Posted by: confused at July 10, 2004 1:47 AM

Spent ages googling this, you just solved my problem ;)

Posted by: Mike at April 20, 2005 3:03 PM

Hope the following URL helps you:

http://www.agapow.net/programming/cpp/implicit-typename

Posted by: Phobos at July 12, 2005 12:09 PM

Good job!

Posted by: Markus at December 13, 2006 12:33 AM
Post a comment









Remember personal info?