Lumiera
0.pre.03
»edit your freedom«
|
Go to the source code of this file.
Managing a collection of non-copyable polymorphic objects in compact storage.
This helper supports the frequently encountered situation where a service implementation internally manages a collection of implementation related sub-components with reference semantics. Typically, those objects are being used polymorphically, and often they are also added step by step. The storage holding all those child objects is allocated in one chunk and never adjusted.
The common ground for all usage of this container is to hold some elements with exclusive ownership; when the enclosing container goes out of scope, all the dtors of the embedded objects will be invoked. Frequently this side effect is the reason for using the container: we want to own some resource handles to be available exactly as long as the managing object needs and accesses them.
There are two different usage patterns for populating a ScopedCollection
I
) or #emplace<Type>(args) to create some subtype. This way, the container is being filled successively.I
. But you need to ensure in this case that the defined buffer size for each element (2nt template parameter) is sufficient to hold any of these subclass instances. This condition is protected by a static assertion (compilation failure). Definition in file scoped-collection.hpp.
#include "lib/error.hpp"
#include "lib/nocopy.hpp"
#include "lib/meta/trait.hpp"
#include "lib/iter-adapter.hpp"
#include <cstddef>
#include <type_traits>
Classes | |
class | ScopedCollection< I, siz >::ElementHolder |
Storage Frame to hold one Child object. More... | |
class | ScopedCollection< I, siz >::FillAll |
class | ScopedCollection< I, siz >::FillWith< TY > |
fills the ScopedCollection with default constructed I-instances More... | |
class | ScopedCollection< I, siz >::FillWith< TY > |
fills the ScopedCollection with default constructed I-instances More... | |
class | ScopedCollection< I, siz >::PullFrom< IT > |
fills the ScopedCollection with default constructed TY-instances More... | |
class | ScopedCollection< I, siz >::PullFrom< IT > |
fills the ScopedCollection with default constructed TY-instances More... | |
class | ScopedCollection< I, siz > |
A fixed collection of non-copyable polymorphic objects. More... | |
Namespaces | |
lib | |
Implementation namespace for support and library code. | |