samedi 26 septembre 2015

How to initialize std stack with std vector ?

I need to put an std::vector into an std::stack.

Here is my method so far :

void ClassName::initializeStack(std::vector<className> & p_vector) {
   m_stackAttribute = std::stack();
   //code that should initialize m_stackAttribute with p_vector
}

Do I have to iterate over the whole vector ? What is the most efficient way to do this ?

Aucun commentaire:

Enregistrer un commentaire