Files
2025-10-25 03:02:53 +03:00

2.0 KiB
Raw Permalink Blame History

[container.requirements.pre]

23 Containers library [containers]

23.2 Requirements [container.requirements]

23.2.1 Preamble [container.requirements.pre]

1

#

Containers are objects that store other objects.

They control allocation and deallocation of these objects through constructors, destructors, insert and erase operations.

2

#

All of the complexity requirements in this Clause are stated solely in terms of the number of operations on the contained objects.

[Example 1:

The copy constructor of typevector<vector> has linear complexity, even though the complexity of copying each containedvector is itself linear.

— end example]

3

#

Allocator-aware containers ([container.alloc.reqmts]) other than basic_string construct elements using the functionallocator_traits<allocator_type>::rebind_traits::construct and destroy elements using the functionallocator_traits<allocator_type>::rebind_traits::destroy ([allocator.traits.members]), where U is either allocator_type::value_type or an internal type used by the container.

These functions are called only for the container's element type, not for internal types used by the container.

[Note 1:

This means, for example, that a node-based container would need to construct nodes containing aligned buffers and call construct to place the element into the buffer.

— end note]