71. Observable vector container

The observable vector described in this problem is a typical example of a subject in the design pattern called observer. This pattern describes an object, called the subject, that maintains a list of dependent objects, called observers, and notifies them of any state changes by calling one of their methods. The class diagram shown here describes a possible pattern implementation for the proposed problem:

observable_vector is a class that wraps an std::vector and exposes the required operations. It also maintains a list of pointers to collection_observer objects. This is a base class for objects that want to ...

Get The Modern C++ Challenge now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.