请注意,我用std::thread
只是在错误得到可读类型:为什么不std :: remove_const删除const限定符?
int main() {
const int * first;
using deref = decltype(*first);
std::thread s = std::remove_const<deref>::type{}; // const int ???
std::thread s2 = deref{}; // const int
std::thread s3 = std::remove_const<const int>::type{}; // int
}
看起来好像remove_const<deref>::type
为const int
,不可更改int
,因为我期望的那样。
你的标题说'remove_reference',但你不用它在你的身体。 –
tnx,固定,正在使用两个原始代码,所以我混淆了:) – NoSenseEtAl
我会建议你使用[this](http://coliru.stacked-crooked.com/a/bfccfe0a5508f107)来显示类型而不是你的'std :: thread'方法,因为它显示的实际类型是'const int&',而你的方法在于你并显示'const int'。 – nwp