任意の型 T の要素を含む任意の STL コンテナー C があります。すべての要素のコピーを持つ std::vector を作成したいと考えています。これを行う最もクリーンな方法は何ですか?
template <typename C>
void myfunction(C container){
/*Derive the type T of elements within the container*/
std::vector<T> mystack;
/* Iterate over container and push_back() the elements into mystack*/
}