Chapter 6
Design Patterns
Section 6
Level 6 - Problem 5
Write a class template that behaves like a vector but can notify registered parties of internal state changes. The class must provide at least the following operations: - Various constructors for creating new instances of the class - operator= to assign values to the container - push_back() to add a new element at the end of the container - pop_back() to remove the last element from the container - clear() to remove all the elements from the container - size() to return the number of elements from the container - empty() to indicate whether the container is empty or has elements - operator=, push_back() , pop_back() , and clear() must notify others of the state changes. The notification should include the type of the change, and, when the case, the index of the element that was changed (such as added or removed).