mardi 22 octobre 2019

I have a question about std::vector

I have a doubt about the structure of std::vector

If there are some class called foo.

I will write down some code for explanation.

class foo
{
  //do something...
};

void main(void)
{
  foo a;
  std::vector<std::shared_ptr<foo>> foo_list;

  //Is it right? If not how can I do that?
  foo_list.push_back(a); 
}

Like this example, If the smart pointer was in vector, How can I put in original class in vector?

Aucun commentaire:

Enregistrer un commentaire