0
나는 아래의 짧은 코드가 문제를 제공벡터 <unique_ptr>는
#include <memory>
#include <vector>
#include <tuple>
using namespace std;
struct A
{
A() {}
vector<unique_ptr<int>> m;
// Change the above line to "unique_ptr<int> m;" removes the compilation error
// Or add a line "A(A const&) = delete;" removes the compilation error also
};
struct B
{
tuple<A> t;
};
int main()
{
A a;
B b;
return 0;
}
VC2013 11 월 CTP 컴파일러 오류 제공 :
오류 1 오류 C2280 : '표준 :: unique_ptr> :: unique_ptr (CONST 표준을 :: unique_ptr < _Ty, 표준 : default_delete < _Ty >> &) ': 삭제 기능 xmemory0 593
이 컴파일러의 버그 또는 코드의 버그를 참조하려고?
[여기 g ++로 작동합니다] (http://coliru.stacked-crooked.com/a/4427e08c08e83a19) –
따라서 컴파일러 버그입니다. 감사. – user1899020
복사 생성자를 삭제하는 이유는 무엇입니까? 당신이 그것을 사용하고 싶지 않다면 단지'비공개'로 만들 수 없을까요? 그리고이 오류는 복사 생성자가 트리거되고 있기 때문에 발생합니다. 나는 그것이 C++에서 당신에게 무엇인지 말해주기에 충분하지 않습니다. – Dan