I'm trying to dllexport a type with a std container of std::unique_ptr member, f.e.
struct __declspec(dllexport) C {
std::vector<std::unique_ptr<int>> c_;
};
but whatever i try, msvc always complains about
msvc/14.33.31629/include\xutility(4145): error C2280: 'std::unique_ptr<int,std::default_delete<int>> &std::unique_ptr<int,std::default_delete<int>>::operator =(const std::unique_ptr<int,std::default_delete<int>> &)': attempting to reference a deleted function
The container type doesn't matter; the error is almost identical (always C2280) for vector, map, and others.
However, as soon as a std::unique_ptr member is added to the type, f.e.
struct __declspec(dllexport) C {
std::vector<std::unique_ptr<int>> c_;
std::unique_ptr<int> rup;
};
the error disappears.
I have no clue if this is the intended behavior, what causes this problem and how it can be fixed without adding a random std::unique_ptr member. What am i missing?