Implementation of thread-safe vector
We probably want to be able to move-construct, so as well as this constructor:


SafeVector(const SafeVector&amp; orig) : vec(orig.vec), mut(), cond() {}



We probably want also:

SafeVector(SafeVector&amp;&amp; orig)
  : vec{std::move(orig.vec)},
    mut{},
    cond{}
{}


I'd recommend being able to construct from a standard vector:

SafeVector(std::vector vec)
  : vec{std::move(vec)},
    mut{},
    cond{}
{}


Since we always default-initialize mut and cond, we could declare their initializers in the class definition, removing the need to have them in the constructors' initializer lists.

There's no need to specify an empty destructor - just let the compiler generate it.

I think we probably want one or more assignment operators.

Big question: how can we safely use iterators we get from begin() and end()?  There's no way for client code to lock the mutex until it's finished using the iterators.