Common System 0.2.0
Common interfaces and patterns for system integration
Loading...
Searching...
No Matches
kcenon::common::concepts::ResizableContainer Concept Referenceexport

A container that can be resized. More...

#include <container.h>

Concept definition

template<typename T>
concept kcenon::common::concepts::ResizableContainer = Container<T> && requires(T t, std::size_t n) {
{ t.resize(n) };
{ t.reserve(n) };
{ t.capacity() } -> std::convertible_to<std::size_t>;
}
A type that satisfies basic container requirements.
Definition container.h:48
A container that can be resized.
Definition container.h:138

Detailed Description

A container that can be resized.

Container that can be resized.

Resizable containers support resize, reserve, and capacity operations.

Example usage:

template<ResizableContainer C>
void ensure_capacity(C& container, std::size_t capacity) {
if (container.capacity() < capacity) {
container.reserve(capacity);
}
}

Definition at line 138 of file container.h.