monotonic_resource::monotonic_resource
Constructors.
Synopsis
explicit
monotonic_resource(
std::size_t initial_size = 1024,
storage_ptr upstream = {}) noexcept; (1)
monotonic_resource(
unsigned char* buffer,
std::size_t size,
storage_ptr upstream = {}) noexcept; (2)
monotonic_resource(
std::byte* buffer,
std::size_t size,
storage_ptr upstream) noexcept; (3)
template<
std::size_t N>
explicit
monotonic_resource(
unsigned char (&buffer) [N],
storage_ptr upstream = {}) noexcept; (4)
template<
std::size_t N>
explicit
monotonic_resource(
std::byte (&buffer) [N],
storage_ptr upstream = {}) noexcept; (5)
monotonic_resource(
monotonic_resource const&) = delete; (6)
Description
Construct the resource.
-
(1) indicates that the first internal dynamic allocation shall be at least
initial_size
bytes. -
(2)–(5) indicate that subsequent allocations should use the specified caller-owned buffer. When this buffer is exhausted, dynamic allocations from the upstream resource are made.
-
(6) copy constructor is deleted. This type is not copyable or movable.
None of the constructors performs any dynamic allocations.
Complexity
Constant.
Exception Safety
No-throw guarantee.
Parameters
Name | Description |
---|---|
|
The size of the first internal dynamic allocation. If this is lower than the implementation-defined lower limit, then the lower limit is used instead. |
|
An optional upstream memory resource to use for performing internal dynamic allocations. If this parameter is omitted, the default resource is used. |
|
The buffer to use. Ownership is not transferred; the caller is responsible for ensuring that the lifetime of the buffer extends until the resource is destroyed. |
|
The number of valid bytes pointed to by |