#ifndef GELIB_IMPL_CONTAINERS_H_
#define GELIB_IMPL_CONTAINERS_H_

#include <vector>

namespace gelib_impl
{

  namespace Containers
  {
    /*
     * Delete a vector of generic objects, clearing all associated memory.
     */
    template<class T>
    void delete_vector(std::vector<T*>& v)
    {
      for (auto& obj : v)
        delete obj;

      v.clear();
    }

    /*
   * copy a vector of unique pointers from v to w, creating a new list of identical associated objects
   */
    template<class T>
    void copy_vector_uptr(const std::vector<std::unique_ptr<T>>& v, std::vector<std::unique_ptr<T>>& w)
    {
      w.reserve(v.size());
      for (auto& ptr : v)
        w.push_back(move(std::make_unique<T>(*ptr)));
    }


  }

}

#endif /* CONTAINERS_H_ */
