C++ How To Program (Early Objects Version), Global Edition, With Access Card, 10 Ed
C++ How To Program (Early Objects Version), Global Edition, With Access Card, 10 Ed
10th Edition
ISBN: 9780134448848
Author: Paul Deitel, Harvey Deitel
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 15, Problem 15.15E
Program Plan Intro

Erasing a container element that contains a pointer to a dynamically allocated object.

When we erase the container element containing pointer to a dynamically allocated object then object has to be destroyed by calling destructor, which release all the resources such as memory else they will remain forever with the container.
In order to release memory we must delete every container element container pointer, then erase the vector and swap as shown in code below

Blurred answer
Students have asked these similar questions
Computer science What is a collection (a container instance)?
A container is an object whose role is to hold other objects. - TRUE - FALSE
return_dict() that takes the name of a CSV file as the input parameter and returns a dictionary, where each key is the Reporting_PHU_ID and the value is a list containing the following data. name of CSV file is "data23.csv"
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT