Reputation:
I'm not sure why I am getting an error on this line.
I am compiling with
$CPP -g -std=c++0x -Wall
Where $CPP is g++-4.7. I am including type_traits (C++11, not boost). Is this not supported yet in 4.7.2?
typedef typename remove_pointer<typename T>::type &U;
Error
file.h:222:44: error: template argument 1 is invalid
file.h:222:19: error: expected nested-name-specifier
file.h:222:47: error: typedef name may not be a nested-name-specifier
file.h:222:47: error: expected ‘;’ at end of member declaration
file.h:222:53: error: ISO C++ forbids declaration of ‘U’ with no type [-fpermissive]
Upvotes: 0
Views: 295
Reputation: 157374
The typename
in typename T
is incorrect; typename
is only to be used on dependent names. Write:
typedef typename remove_pointer<T>::type &U;
Upvotes: 3