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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.