我似乎遇到了编译器/库错误。当我尝试MSVC - 我如何知道一个类型是否必须移动?
#include <iostream>
#include <type_traits>
#include <memory>
int main()
{
typedef std::unique_ptr<int> T;
std::cout << "is_copy_assignable: "
<< std::is_copy_assignable<T>::value
<< "\n"
<< "is_copy_constructible: "
<< std::is_copy_constructible<T>::value << "\n";
}
与Visual Studio 2012 Update 1中,我得到
is_copy_assignable: 1
is_copy_constructible: 1
代替
is_copy_assignable: 0
is_copy_constructible: 0
是否有其他解决方案?
还有一个相关的问题:https://stackoverflow.com/questions/34135409/why-does-is-copy-constructible-return-true-for-unique-ptr-in-msvc12 – stgatilov 2018-03-04 07:05:27