BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslstl_simplepool.h
Go to the documentation of this file.
1/// @file bslstl_simplepool.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bslstl_simplepool.h -*-C++-*-
8#ifndef INCLUDED_BSLSTL_SIMPLEPOOL
9#define INCLUDED_BSLSTL_SIMPLEPOOL
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup bslstl_simplepool bslstl_simplepool
15/// @brief Provide efficient allocation of memory blocks for a specific type.
16/// @addtogroup bsl
17/// @{
18/// @addtogroup bslstl
19/// @{
20/// @addtogroup bslstl_simplepool
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bslstl_simplepool-purpose"> Purpose</a>
25/// * <a href="#bslstl_simplepool-classes"> Classes </a>
26/// * <a href="#bslstl_simplepool-description"> Description </a>
27/// * <a href="#bslstl_simplepool-comparison-with-bdema_pool"> Comparison with bdema_Pool </a>
28/// * <a href="#bslstl_simplepool-usage"> Usage </a>
29/// * <a href="#bslstl_simplepool-example-1-creating-a-node-based-stack"> Example 1: Creating a Node-Based Stack </a>
30///
31/// # Purpose {#bslstl_simplepool-purpose}
32/// Provide efficient allocation of memory blocks for a specific type.
33///
34/// # Classes {#bslstl_simplepool-classes}
35///
36/// - bslstl::SimplePool: memory manager that allocates memory blocks for a type
37///
38/// @see bslstl_treenodepool, bdlma_pool
39///
40/// # Description {#bslstl_simplepool-description}
41/// This component implements a memory pool, `bslstl::SimplePool`,
42/// that allocates and manages memory blocks of for a parameterized type. A
43/// `bslstl::SimplePool` object maintains an internal linked list of
44/// free memory blocks, and dispenses one block for each `allocate` method
45/// invocation. When a memory block is deallocated, it is returned to the free
46/// list for potential reuse.
47///
48/// Whenever the linked list of free memory blocks is depleted,
49/// `bslstl::SimplePool` replenishes the list by first allocating a large,
50/// contiguous "chunk" of memory, then splitting the chunk into multiple memory
51/// blocks each having the `sizeof` the simple pool's parameterized type. A
52/// chunk and its constituent memory blocks can be depicted visually:
53/// @code
54/// +-----+--- memory blocks of uniform size for parameterized type
55/// | |
56/// ----- ----- ------------
57/// | | | ... |
58/// =====^=====^============
59///
60/// \___________ __________/
61/// V
62/// a "chunk"
63/// @endcode
64/// This pool implementation is simple because its allocation strategy is not
65/// configurable. The size of a chunk starts from 1 memory block, and doubles
66/// each time a chunk is allocated up to an implementation defined maximum
67/// number of blocks.
68///
69/// ## Comparison with bdema_Pool {#bslstl_simplepool-comparison-with-bdema_pool}
70///
71///
72/// There are a few differences between `bslstl::SimplePool` and `bdema_Pool`:
73/// 1. `bslstl::SimplePool` is parameterized on both allocator and type, which
74/// improve performance and memory usage in exchange for increase in code
75/// size.
76/// 2. `bslstl::SimplePool` uses the allocator through the use of
77/// `bsl::allocator_traits` (which is generally not relevant to non-container
78/// type.
79/// 3. `bslstl::SimplePool` is less configurable in order to achieve abstraction
80/// of allocation and improvement in performance.
81///
82/// Clients are encouraged to use `bdema_Pool` as `bslstl::SimplePool` is
83/// designed for node-based STL containers, and its pooling behavior may change
84/// according to the needs of those containers.
85///
86/// ## Usage {#bslstl_simplepool-usage}
87///
88///
89/// This section illustrates intended use for this component.
90///
91/// ### Example 1: Creating a Node-Based Stack {#bslstl_simplepool-example-1-creating-a-node-based-stack}
92///
93///
94/// Suppose that we want to implement a stack with a linked list. It is
95/// expensive to allocate memory every time a node is inserted. Therefore, we
96/// can use `SimplePool` to efficiently manage the memory for the list.
97///
98/// First, we define the class that implements the stack:
99/// @code
100/// /// This class defines a node-based stack of integers.
101/// template <class ALLOCATOR = bsl::allocator<int> >
102/// class my_Stack {
103///
104/// // PRIVATE TYPES
105///
106/// /// This `struct` implements a link data structure containing a
107/// /// value and a pointer to the next node.
108/// struct Node {
109///
110/// int d_value; // payload value
111/// Node *d_next_p; // pointer to the next node
112/// };
113///
114/// typedef bslstl::SimplePool<Node, ALLOCATOR> Pool;
115/// // Alias for memory pool.
116///
117/// private:
118/// // DATA
119/// Node *d_head_p; // pointer to the first node
120/// int d_size; // size of the stack
121/// Pool d_pool; // memory manager for the stack
122///
123/// public:
124/// // CREATORS
125///
126/// /// Create an empty `my_Stack` object. Optionally specify a
127/// /// `basicAllocator` used to supply memory. If `basicAllocator` is
128/// /// 0, the currently installed default allocator is used.
129/// my_Stack(const ALLOCATOR& allocator = ALLOCATOR());
130///
131/// // MANIPULATORS
132///
133/// /// Insert an element with the specified value to the top of this
134/// /// stack.
135/// void push(int value);
136///
137/// /// Remove the top element from this stack. The behavior is
138/// /// undefined unless `1 <= size()`.
139/// void pop();
140///
141/// // ACCESSORS
142///
143/// /// Return the value of the element on the top of this stack. The
144/// /// behavior is undefined unless `1 <= size()`.
145/// int top();
146///
147/// /// Return the number of elements in this stack.
148/// std::size_t size();
149/// };
150/// @endcode
151/// Now, we define the implementation of the stack. Notice how
152/// `bslstl::SimplePool` is used to allocate memory in `push` and deallocate
153/// memory in `pop`:
154/// @code
155/// // CREATORS
156/// template <class ALLOCATOR>
157/// my_Stack<ALLOCATOR>::my_Stack(const ALLOCATOR& allocator)
158/// : d_head_p(0)
159/// , d_size(0)
160/// , d_pool(allocator)
161/// {
162/// }
163///
164/// // MANIPULATORS
165/// template <class ALLOCATOR>
166/// void my_Stack<ALLOCATOR>::push(int value)
167/// {
168/// Node *newNode = d_pool.allocate();
169///
170/// newNode->d_value = value;
171/// newNode->d_next_p = d_head_p;
172/// d_head_p = newNode;
173///
174/// ++d_size;
175/// }
176///
177/// template <class ALLOCATOR>
178/// void my_Stack<ALLOCATOR>::pop()
179/// {
180/// BSLS_ASSERT(0 != size());
181///
182/// Node *n = d_head_p;
183/// d_head_p = d_head_p->d_next_p;
184/// d_pool.deallocate(n);
185/// --d_size;
186/// }
187///
188/// // ACCESSORS
189/// template <class ALLOCATOR>
190/// int my_Stack<ALLOCATOR>::top()
191/// {
192/// BSLS_ASSERT(0 != size());
193///
194/// return d_head_p->d_value;
195/// }
196///
197/// template <class ALLOCATOR>
198/// std::size_t my_Stack<ALLOCATOR>::size()
199/// {
200/// return d_size;
201/// }
202/// @endcode
203/// Finally, we test our stack by pushing and popping some elements:
204/// @code
205/// my_Stack stack;
206/// stack.push(1);
207/// stack.push(2);
208/// stack.push(3);
209/// stack.push(4);
210/// stack.push(5);
211/// assert(5 == stack.size());
212///
213/// assert(5 == stack.top());
214/// stack.pop();
215/// assert(4 == stack.top());
216/// stack.pop();
217/// assert(3 == stack.top());
218/// stack.pop();
219/// assert(2 == stack.top());
220/// stack.pop();
221/// assert(1 == stack.top());
222/// stack.pop();
223/// assert(0 == stack.size());
224/// @endcode
225/// @}
226/** @} */
227/** @} */
228
229/** @addtogroup bsl
230 * @{
231 */
232/** @addtogroup bslstl
233 * @{
234 */
235/** @addtogroup bslstl_simplepool
236 * @{
237 */
238
239#include <bslscm_version.h>
240
242#include <bslma_allocatorutil.h>
243
244#include <bslmf_movableref.h>
245
247#include <bsls_alignmentutil.h>
248#include <bsls_assert.h>
249#include <bsls_platform.h>
250
251#include <algorithm> // swap (C++03)
252#include <utility> // swap (C++17)
253
254
255namespace bslstl {
256
257 // ======================
258 // struct SimplePool_Type
259 // ======================
260
261/// For use only by `bslstl::SimplePool`. This `struct` provides a
262/// namespace for a set of types used to define the base-class of a
263/// `SimplePool`. The parameterized `ALLOCATOR` is bound to
264/// `MaxAlignedType` to ensure the allocated memory is maximally aligned.
265template <class ALLOCATOR>
267
268 /// Alias for the allocator traits rebound to allocate
269 /// `bsls::AlignmentUtil::MaxAlignedType`.
271 rebind_traits<bsls::AlignmentUtil::MaxAlignedType> AllocatorTraits;
272
273 /// Alias for the allocator type for
274 /// `bsls::AlignmentUtil::MaxAlignedType`.
275 typedef typename AllocatorTraits::allocator_type AllocatorType;
276};
277
278 // ================
279 // class SimplePool
280 // ================
281
282/// This class provides methods for creating and deleting nodes using the
283/// appropriate allocator-traits of the parameterized `ALLOCATOR`.
284/// This type is intended to be used as a private base-class for a
285/// node-based container, in order to take advantage of the
286/// empty-base-class optimization in the case where the base-class has 0
287/// size (as may the case if the parameterized `ALLOCATOR` is not a
288/// `bslma::Allocator`).
289///
290/// See @ref bslstl_simplepool
291template <class VALUE, class ALLOCATOR>
292class SimplePool : public SimplePool_Type<ALLOCATOR>::AllocatorType {
293
294 // PRIVATE TYPES
296
297 enum { k_MAX_BLOCKS_PER_CHUNK = 32 };
298
299 /// This `union` implements a link data structure with the size no
300 /// smaller than `VALUE` that stores the address of the next link.
301 /// It is used to implement the internal linked list of free memory
302 /// blocks.
303 union Block {
304
305 Block *d_next_p; // pointer to the next block
306
307 char d_size[sizeof(VALUE)]; // make a block has the size of at
308 // least `VALUE`
309
310 typename bsls::AlignmentFromType<VALUE>::Type d_alignment;
311 // ensure proper alignment
312 };
313
314 /// This `union` prepends to the beginning of each managed block of
315 /// allocated memory, implementing a singly-linked list of managed
316 /// chunks, and thereby enabling constant-time additions to the list of
317 /// chunks.
318 union Chunk {
319
320 struct {
321 Chunk *d_next_p;
322 typename Types::AllocatorTraits::size_type d_numBytes;
323 } d_info;
324
325 typename bsls::AlignmentFromType<Block>::Type d_alignment;
326 // ensure each block is correctly aligned
327
328 /// Return a pointer to the first block in this chunk.
329 Block *firstBlock()
330 { return reinterpret_cast<Block *>(this + 1); }
331 };
332
333 public:
334 // TYPES
335
336 /// Alias for the parameterized type `VALUE`.
337 typedef VALUE ValueType;
338
339 /// Alias for the allocator type for a
340 /// `bsls::AlignmentUtil::MaxAlignedType`.
342
343 /// Alias for the allocator traits for the parameterized
344 /// `ALLOCATOR`.
346
347 typedef typename AllocatorTraits::size_type size_type;
348
349 private:
350 // DATA
351 Chunk *d_chunkList_p; // linked list of "chunks" of memory
352
353 Block *d_freeList_p; // linked list of free memory blocks
354
355 int d_blocksPerChunk; // current chunk size (in blocks-per-chunk)
356
357 private:
358 // NOT IMPLEMENTED
360 SimplePool& operator=(const SimplePool&);
361 SimplePool(const SimplePool&);
362
363 private:
364 // PRIVATE MANIPULATORS
365
366 /// Allocate a chunk of memory having enough usable blocks for the
367 /// specified `numBlocks` objects of type `VALUE`, add the chunk to the
368 /// chunk list, and return the address of the chunk header.
369 Chunk *allocateChunk(std::size_t numBlocks);
370
371 /// Deallocate a chunk of memory at the specified `chunk_p` address.
372 /// The behavior is undefined unless `chunk_p` was allocate from this
373 /// pool using `allocateChunk` and not yet deallocated.
374 void deallocateChunk(Chunk *chunk_p);
375
376 /// Dynamically allocate a new chunk using the pool's underlying growth
377 /// strategy, and use the chunk to replenish the free memory list of
378 /// this pool.
379 void replenish();
380
381 public:
382 // CREATORS
383
384 /// Create a memory pool that returns blocks of contiguous memory of the
385 /// size of the parameterized `VALUE` using the specified `allocator` to
386 /// supply memory. The chunk size grows starting with at least
387 /// `sizeof(VALUE)`, doubling in size up to an implementation defined
388 /// maximum number of blocks per chunk.
389 explicit SimplePool(const ALLOCATOR& allocator);
390
391 /// Create a memory pool, adopting all outstanding memory allocations
392 /// associated with the specified `original` pool, that returns blocks
393 /// of contiguous memory of the sizeof the paramterized `VALUE` using
394 /// the allocator associated with `original`. The chunk size is set to
395 /// that of `original` and continues to double in size up to an
396 /// implementation defined maximum number of blocks per chunk. Note
397 /// that `original` is left in a valid but unspecified state.
399
400 /// Destroy this pool, releasing all associated memory back to the
401 /// underlying allocator.
403
404 // MANIPULATORS
405
406 /// Adopt all outstanding memory allocations associated with the
407 /// specfied memory `pool`. The behavior is undefined unless this pool
408 /// uses the same allocator as that associated with `pool`. The
409 /// behavior is undefined unless this pool is in the default-constructed
410 /// state.
412
413 /// Return a reference providing modifiable access to the rebound
414 /// allocator traits for the node-type. Note that this operation
415 /// returns a base-class (`AllocatorType`) reference to this object.
417
418 /// Return the address of a block of memory of at least the size of
419 /// `VALUE`. Note that the memory is *not* initialized.
420 VALUE *allocate();
421
422 /// Relinquish the memory block at the specified `address` back to this
423 /// pool object for reuse. The behavior is undefined unless `address`
424 /// is non-zero, was allocated by this pool, and has not already been
425 /// deallocated.
426 void deallocate(void *address);
427
428 /// Dynamically allocate a new chunk containing the specified
429 /// `numBlocks` number of blocks, and add the chunk to the free memory
430 /// list of this pool. The additional memory is added irrespective of
431 /// the amount of free memory when called. The behavior is undefined
432 /// unless `0 < numBlocks`.
433 void reserve(size_type numBlocks);
434
435 /// Relinquish all memory currently allocated via this pool object.
436 void release();
437
438 /// Efficiently exchange the memory blocks of this object with those of
439 /// the specified `other` object. This method provides the no-throw
440 /// exception-safety guarantee. The behavior is undefined unless
441 /// `allocator() == other.allocator()`.
442 void swap(SimplePool& other);
443
444 /// Efficiently exchange the memory blocks of this object with those of
445 /// the specified `other` object. This method provides the no-throw
446 /// exception-safety guarantee. The behavior is undefined unless
447 /// `allocator() == other.allocator()`.
449
450 /// Efficiently exchange the memory blocks and the allocator of this
451 /// object with those of the specified `other` object. This method
452 /// provides the no-throw exception-safety guarantee.
454
455 // ACCESSORS
456
457 /// Return a reference providing non-modifiable access to the rebound
458 /// allocator traits for the node-type. Note that this operation
459 /// returns a base-class (`AllocatorType`) reference to this object.
460 const AllocatorType& allocator() const;
461
462 /// Return `true` if this object holds free (currently unused) blocks,
463 /// and `false` otherwise.
464 bool hasFreeBlocks() const;
465};
466
467// ============================================================================
468// TEMPLATE AND INLINE FUNCTION DEFINITIONS
469// ============================================================================
470
471// PRIVATE MANIPULATORS
472template <class VALUE, class ALLOCATOR>
475{
476 std::size_t numBytes = sizeof(Chunk) + sizeof(Block) * numBlocks;
477 const std::size_t alignment = bsls::AlignmentFromType<Chunk>::VALUE;
478
479 Chunk *chunkPtr =
480 static_cast<Chunk *>(bslma::AllocatorUtil::allocateBytes(allocator(),
481 numBytes,
482 alignment));
483
485 reinterpret_cast<bsls::Types::UintPtr>(chunkPtr) % alignment);
486
487 chunkPtr->d_info.d_next_p = d_chunkList_p;
488 chunkPtr->d_info.d_numBytes = numBytes;
489 d_chunkList_p = chunkPtr;
490
491 return chunkPtr;
492}
493
494template <class VALUE, class ALLOCATOR>
495inline void
496SimplePool<VALUE, ALLOCATOR>::deallocateChunk(Chunk *chunk_p)
497{
498 std::size_t numBytes = chunk_p->d_info.d_numBytes;
499 const std::size_t alignment = bsls::AlignmentFromType<Chunk>::VALUE;
500
501 bslma::AllocatorUtil::deallocateBytes(allocator(), chunk_p,
502 numBytes, alignment);
503}
504
505template <class VALUE, class ALLOCATOR>
506inline
507void SimplePool<VALUE, ALLOCATOR>::replenish()
508{
509 reserve(d_blocksPerChunk);
510
511 if (d_blocksPerChunk < k_MAX_BLOCKS_PER_CHUNK) {
512 d_blocksPerChunk *= 2;
513 }
514}
515
516// CREATORS
517template <class VALUE, class ALLOCATOR>
518inline
520: AllocatorType(allocator)
521, d_chunkList_p(0)
522, d_freeList_p(0)
523, d_blocksPerChunk(1)
524{
525}
526
527template <class VALUE, class ALLOCATOR>
528inline
531: AllocatorType(bslmf::MovableRefUtil::access(original).allocator())
532, d_chunkList_p(bslmf::MovableRefUtil::access(original).d_chunkList_p)
533, d_freeList_p(bslmf::MovableRefUtil::access(original).d_freeList_p)
534, d_blocksPerChunk(bslmf::MovableRefUtil::access(original).d_blocksPerChunk)
535{
536 SimplePool& lvalue = original;
537 lvalue.d_chunkList_p = 0;
538 lvalue.d_freeList_p = 0;
539 lvalue.d_blocksPerChunk = 1;
540}
541
542template <class VALUE, class ALLOCATOR>
543inline
548
549// MANIPULATORS
550template <class VALUE, class ALLOCATOR>
551inline
552void
554{
555 BSLS_ASSERT_SAFE(0 == d_chunkList_p);
556 BSLS_ASSERT_SAFE(0 == d_freeList_p);
557 BSLS_ASSERT_SAFE(allocator()
558 == bslmf::MovableRefUtil::access(pool).allocator());
559
560 SimplePool& lvalue = pool;
561 d_chunkList_p = lvalue.d_chunkList_p;
562 d_freeList_p = lvalue.d_freeList_p;
563 d_blocksPerChunk = lvalue.d_blocksPerChunk;
564
565 lvalue.d_chunkList_p = 0;
566 lvalue.d_freeList_p = 0;
567 lvalue.d_blocksPerChunk = 1;
568}
569
570template <class VALUE, class ALLOCATOR>
571inline
574{
575 return *this;
576}
577
578template <class VALUE, class ALLOCATOR>
579inline
581{
582 if (!d_freeList_p) {
583 replenish();
584 }
585 VALUE *block = reinterpret_cast<VALUE *>(d_freeList_p);
586 d_freeList_p = d_freeList_p->d_next_p;
587 return block;
588}
589
590template <class VALUE, class ALLOCATOR>
591inline
593{
594 BSLS_ASSERT_SAFE(address);
595
596 reinterpret_cast<Block *>(address)->d_next_p = d_freeList_p;
597 d_freeList_p = reinterpret_cast<Block *>(address);
598}
599
600template <class VALUE, class ALLOCATOR>
601inline
603{
604 BSLS_ASSERT_SAFE(allocator() == other.allocator());
605
606 std::swap(d_blocksPerChunk, other.d_blocksPerChunk);
607 std::swap(d_freeList_p, other.d_freeList_p);
608 std::swap(d_chunkList_p, other.d_chunkList_p);
609}
610
611template <class VALUE, class ALLOCATOR>
612inline
618
619template <class VALUE, class ALLOCATOR>
620inline
623{
624 // We don't know which operation (copy/move assignment or swap) this
625 // function is being called for, but if any of the propagation traits are
626 // true, then the allocator must support assignment, so we turn propagation
627 // on for all of them.
628 typedef bsl::allocator_traits<ALLOCATOR> AllocTraits;
630 bool,
631 AllocTraits::propagate_on_container_copy_assignment::value ||
632 AllocTraits::propagate_on_container_move_assignment::value ||
633 AllocTraits::propagate_on_container_swap::value> Propagate;
634
635 using std::swap;
636 using BloombergLP::bslma::AllocatorUtil;
637 AllocatorUtil::swap(&this->allocator(), &other.allocator(), Propagate());
638 swap(d_blocksPerChunk, other.d_blocksPerChunk);
639 swap(d_freeList_p, other.d_freeList_p);
640 swap(d_chunkList_p, other.d_chunkList_p);
641}
642
643template <class VALUE, class ALLOCATOR>
645{
646 BSLS_ASSERT(0 < numBlocks);
647
648 Block *begin = allocateChunk(numBlocks)->firstBlock();
649 Block *end = begin + numBlocks - 1; // last block, NOT past-the-end
650
651 // The last block is deliberately excluded from this loop.
652 for (Block *p = begin; p < end; ++p) {
653 p->d_next_p = p + 1;
654 }
655 end->d_next_p = d_freeList_p; // Handle the last block here
656 d_freeList_p = begin;
657}
658
659template <class VALUE, class ALLOCATOR>
661{
662 while (d_chunkList_p) {
663 Chunk *lastChunk = d_chunkList_p;
664 d_chunkList_p = d_chunkList_p->d_info.d_next_p;
665 deallocateChunk(lastChunk);
666 }
667
668 d_freeList_p = 0;
669}
670
671// ACCESSORS
672template <class VALUE, class ALLOCATOR>
673inline
676{
677 return *this;
678}
679
680template <class VALUE, class ALLOCATOR>
681inline
683{
684 return d_freeList_p;
685}
686
687} // close package namespace
688
689
690#endif
691
692// ----------------------------------------------------------------------------
693// Copyright 2019 Bloomberg Finance L.P.
694//
695// Licensed under the Apache License, Version 2.0 (the "License");
696// you may not use this file except in compliance with the License.
697// You may obtain a copy of the License at
698//
699// http://www.apache.org/licenses/LICENSE-2.0
700//
701// Unless required by applicable law or agreed to in writing, software
702// distributed under the License is distributed on an "AS IS" BASIS,
703// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
704// See the License for the specific language governing permissions and
705// limitations under the License.
706// ----------------------------- END-OF-FILE ----------------------------------
707
708/** @} */
709/** @} */
710/** @} */
Definition bslmf_movableref.h:751
Definition bslstl_simplepool.h:292
void release()
Relinquish all memory currently allocated via this pool object.
Definition bslstl_simplepool.h:660
Types::AllocatorType AllocatorType
Definition bslstl_simplepool.h:341
void adopt(bslmf::MovableRef< SimplePool > pool)
Definition bslstl_simplepool.h:553
bool hasFreeBlocks() const
Definition bslstl_simplepool.h:682
const AllocatorType & allocator() const
Definition bslstl_simplepool.h:675
void quickSwapExchangeAllocators(SimplePool &other)
Definition bslstl_simplepool.h:621
VALUE ValueType
Alias for the parameterized type VALUE.
Definition bslstl_simplepool.h:337
void deallocate(void *address)
Definition bslstl_simplepool.h:592
AllocatorType & allocator()
Definition bslstl_simplepool.h:573
AllocatorTraits::size_type size_type
Definition bslstl_simplepool.h:347
~SimplePool()
Definition bslstl_simplepool.h:544
SimplePool(const ALLOCATOR &allocator)
Definition bslstl_simplepool.h:519
void quickSwapRetainAllocators(SimplePool &other)
Definition bslstl_simplepool.h:613
void reserve(size_type numBlocks)
Definition bslstl_simplepool.h:644
void swap(SimplePool &other)
Definition bslstl_simplepool.h:602
VALUE * allocate()
Definition bslstl_simplepool.h:580
SimplePool(bslmf::MovableRef< SimplePool > original)
Definition bslstl_simplepool.h:529
Types::AllocatorTraits AllocatorTraits
Definition bslstl_simplepool.h:345
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1804
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1762
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bdlbb_blob.h:576
Definition bslstl_algorithm.h:82
void swap(TYPE &a, TYPE &b)
Definition bslma_allocatortraits.h:1061
Definition bslmf_integralconstant.h:244
static void deallocateBytes(const t_ALLOCATOR &allocator, typename AllocatorUtil_Traits< t_ALLOCATOR >::void_pointer p, std::size_t nbytes, std::size_t alignment=k_MAX_ALIGNMENT)
Definition bslma_allocatorutil.h:911
static AllocatorUtil_Traits< t_ALLOCATOR >::void_pointer allocateBytes(const t_ALLOCATOR &allocator, std::size_t nbytes, std::size_t alignment=k_MAX_ALIGNMENT)
Definition bslma_allocatorutil.h:871
static t_TYPE & access(t_TYPE &ref) BSLS_KEYWORD_NOEXCEPT
Definition bslmf_movableref.h:1032
Definition bsls_alignmentfromtype.h:376
AlignmentToType< VALUE >::Type Type
Definition bsls_alignmentfromtype.h:386
std::size_t UintPtr
Definition bsls_types.h:126
Definition bslstl_simplepool.h:266
AllocatorTraits::allocator_type AllocatorType
Definition bslstl_simplepool.h:275
bsl::allocator_traits< ALLOCATOR >::template rebind_traits< bsls::AlignmentUtil::MaxAlignedType > AllocatorTraits
Definition bslstl_simplepool.h:271