It appears that std::remove_const isn't able to remove the const-ness of const char*
. Consider the following code:
#include <iostream>
#include <type_traits>
#include <typeinfo>
template< typename T >
struct S
{
static void foo( ) {
std::cout << typeid(T).name() << std::endl;
std::cout << typeid( std::remove_const<T>::type ).name() << std::endl;
}
};
int main( )
{
S<char const*>::foo();
}
Output of this program (on Visual Studio 2010):
char const *
char const *
And in gcc we have the readable output (code here):
PKc
PKc
I would hope to get char *
on the second line of Microsoft compiler, and whatever (but different than 1st line) on gcc. What am I doing wrong? How do I turn char const*
to char*
?