Collections

The concepts

The collection concepts are similar to the STL container concepts. The major difference however is that collections do not necessarily 'own' their elements. Thus the lifetime of their elements can exceed the lifetime of the collection. If the lifetime of the collection exceeds the lifetime of the elements, using the collection (except destructing the collection) results in undefined behaviour.

Goal

The collections are a family of basic concepts that will be inherited from by all containers, views and adaptors. Due to this (conceptual) inheritance, algorithms that only require functionality implemented by these concepts can be reused on containers, views and adaptors.

Relation between lifetime of the collection and its elements

Collections are not required to know about the lifetime of their elements. So they might not be aware that the lifetime of their elements have expired. Some collections might however prevent such a situation by using shared pointers for instance to the container of the elements. Others might use weak pointers to be able to know if the lifetime of the elements have expired or not.

Relation to Structure concept

The difference lies in that a Structure does not have numeric values, only structional information. The concepts, including their member types and member functions are very similar.