// suppose you want to copy list to a vector
// instead of using a for loop, You can use to the std:: algorithm
// to keep the code cleaner
std::list <int> list;
std::vector <int> vector;
/// WARNING ---
/// YOU MUST ALLOCATE ENOUGH SPACE IN THE CONTAINER BEFORE COPY
vector.resize (list.size());
std::copy (list.begin(), list.end(), vector.begin());