請注意,我用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