考虑以下代码:
typedef const std::string const_string_type;
cout << std::is_const<const_string_type>::value << endl;
cout << std::is_const<std::remove_pointer<const_string_type>::type>::value << endl;
这输出
1
0
这意味着从类型中std::remove_pointer<const_string_type>::type
删除了const
限定符。我的理解是,std::remove_pointer
如果类型不是指针,则应该产生完全相同的类型(限定符和所有)。
这是正确的行为,还是可能是编译器实现问题?