类型特征是否应该能够处理诸如std::vector < std::unique_ptr <int> >并且检测到它不是可复制构造的情况?
以下是https://ideone.com/gbcRUa(运行g ++ 4.8.1)的示例
#include <type_traits>
#include <vector>
#include <iostream>
#include <memory>
int main()
{
// This prints 1, implying that it's copy constructible, when it's clearly not
std::cout << std::is_copy_constructible< std::vector<std::unique_ptr<int> > >::value << std::endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
如果这是正确的行为is_copy_constructible,有没有办法检测复制结构是否形成错误?好吧,除了让它无法编译之外.