Consider the following program:
#include <iostream>
#include <type_traits>
int main(int argc, char* argv[])
{
std::cout << std::is_same<decltype("hello"), char*>::value << std::endl;
std::cout << std::is_same<decltype("hello"), const char*>::value << std::endl;
std::cout << std::is_same<decltype("hello"), char[5]>::value << std::endl;
std::cout << std::is_same<decltype("hello"), const char[5]>::value << std::endl;
std::cout << std::is_same<decltype("hello"), char[6]>::value << std::endl;
std::cout << std::is_same<decltype("hello"), const char[6]>::value << std::endl;
std::cout << std::is_same<decltype("hello"), char[]>::value << std::endl;
std::cout << std::is_same<decltype("hello"), const char[]>::value << std::endl;
return 0;
}
It returns only zeroes, while I would have expected "hello"
to be a const char[6]
. What is the type of "hello"
?