I understand that the following code does not compile since the move constructor of A is deleted because the mutex is not movable.
class A {
public:
A(int i) {}
private:
std::mutex m;
};
int main() {
std::vector<A> v;
v.emplace_back(2);
}
But if I want my A
to be stored in an std container how should I go about this? I am fine with A
being constructed "inside" the container.