c++ - Using STL list container, a linked list as an attribute needed to be initialised? -


I am confused that when using a STL list as a feature in a class, do we link to Need to start the list constructor, and how can we release the memory system using the destructor? I understand that STL is a desctrutor in the list that automatically removes the linked list. However, my instructor asked us to include the destroyer for the class. So I'm finding out how to deal with the list feature?

So I have a column class, which has a linked list of four which is its property. So far I have:

  class column {private: list & lt; Char & gt; Character; List & lt; Char & gt; :: const_iterator IRR; Public: column () {} ~ column () {} .....};  

So do I need to start the characters in the linked list inside the constructor, and do I need to remove the linked list in the district? I know that we normally delete after using the new one. Or can I just leave the content of the constructor and thus the empty destructive? Thanks for your help.

You do not need to call Constructor and Destructors of the std :: list member clearly compiler Will handle them for you.

So yes, you can leave the controller and destroyer of this class empty.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -