[mem.res.pool.ctor] (original) (raw)

20 Memory management library [mem]

20.5 Memory resources [mem.res]

20.5.5 Pool resource classes [mem.res.pool]

20.5.5.3 Constructors and destructors [mem.res.pool.ctor]

synchronized_pool_resource(const pool_options& opts, memory_resource* upstream); unsynchronized_pool_resource(const pool_options& opts, memory_resource* upstream);

Preconditions: upstream is the address of a valid memory resource.

Effects: Constructs a pool resource object that will obtain memory from upstreamwhenever the pool resource is unable to satisfy a memory request from its own internal data structures.

The resulting object will hold a copy of upstream, but will not own the resource to which upstream points.

[Note 1:

The intention is that calls to upstream->allocate()will be substantially fewer than calls to this->allocate()in most cases.

— _end note_]

The behavior of the pooling mechanism is tuned according to the value of the opts argument.

Throws: Nothing unless upstream->allocate() throws.

It is unspecified if, or under what conditions, this constructor calls upstream->allocate().

virtual ~synchronized_pool_resource();virtual ~unsynchronized_pool_resource();

Effects: Calls release().