11#ifndef INCLUDED_BSLSTL_BIDIRECTIONALNODEPOOL_CPP03
12#define INCLUDED_BSLSTL_BIDIRECTIONALNODEPOOL_CPP03
63#ifdef COMPILING_BSLSTL_BIDIRECTIONALNODEPOOL_H
77template <
class VALUE,
class ALLOCATOR>
78class BidirectionalNodePool {
83 typedef SimplePool<bslalg::BidirectionalNode<VALUE>, ALLOCATOR> Pool;
98 BidirectionalNodePool& operator=(
const BidirectionalNodePool&);
99 BidirectionalNodePool(
const BidirectionalNodePool&);
108 typedef typename AllocatorTraits::size_type
size_type;
117 explicit BidirectionalNodePool(
const ALLOCATOR&
allocator);
165#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
168#ifndef BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT
169#define BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT 10
171#ifndef BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A
172#define BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT
174#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A >= 0
179#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A >= 1
180 template <
class Args_01>
185#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A >= 2
186 template <
class Args_01,
193#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A >= 3
194 template <
class Args_01,
203#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A >= 4
204 template <
class Args_01,
215#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A >= 5
216 template <
class Args_01,
229#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A >= 6
230 template <
class Args_01,
245#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A >= 7
246 template <
class Args_01,
263#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A >= 8
264 template <
class Args_01,
283#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A >= 9
284 template <
class Args_01,
305#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A >= 10
306 template <
class Args_01,
332 template <
class... Args>
382template <
class VALUE,
class ALLOCATOR>
383void swap(BidirectionalNodePool<VALUE, ALLOCATOR>& a,
384 BidirectionalNodePool<VALUE, ALLOCATOR>& b);
398template <
class VALUE,
class ALLOCATOR>
399struct IsBitwiseMoveable<
bslstl::BidirectionalNodePool<VALUE, ALLOCATOR> >
412template <
class VALUE,
class ALLOCATOR>
414BidirectionalNodePool<VALUE, ALLOCATOR>::BidirectionalNodePool(
415 const ALLOCATOR& allocator)
420template <
class VALUE,
class ALLOCATOR>
422BidirectionalNodePool<VALUE, ALLOCATOR>::BidirectionalNodePool(
424: d_pool(MoveUtil::move(MoveUtil::access(original).d_pool))
429template <
class VALUE,
class ALLOCATOR>
431void BidirectionalNodePool<VALUE, ALLOCATOR>::adopt(
434 BidirectionalNodePool& lvalue = pool;
435 d_pool.adopt(MoveUtil::move(lvalue.d_pool));
438template <
class VALUE,
class ALLOCATOR>
441SimplePool<bslalg::BidirectionalNode<VALUE>, ALLOCATOR>::AllocatorType&
442BidirectionalNodePool<VALUE, ALLOCATOR>::allocator()
444 return d_pool.allocator();
447template <
class VALUE,
class ALLOCATOR>
450BidirectionalNodePool<VALUE, ALLOCATOR>::cloneNode(
453 return emplaceIntoNewNode(
457#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
460#ifndef BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT
461#define BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT 10
463#ifndef BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B
464#define BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT
466#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B >= 0
467template <
class VALUE,
class ALLOCATOR>
470BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
476 AllocatorTraits::construct(
484#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B >= 1
485template <
class VALUE,
class ALLOCATOR>
486template <
class Args_01>
489BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
495 AllocatorTraits::construct(
504#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B >= 2
505template <
class VALUE,
class ALLOCATOR>
506template <
class Args_01,
510BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
517 AllocatorTraits::construct(
527#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B >= 3
528template <
class VALUE,
class ALLOCATOR>
529template <
class Args_01,
534BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
542 AllocatorTraits::construct(
553#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B >= 4
554template <
class VALUE,
class ALLOCATOR>
555template <
class Args_01,
561BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
570 AllocatorTraits::construct(
582#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B >= 5
583template <
class VALUE,
class ALLOCATOR>
584template <
class Args_01,
591BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
601 AllocatorTraits::construct(
614#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B >= 6
615template <
class VALUE,
class ALLOCATOR>
616template <
class Args_01,
624BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
635 AllocatorTraits::construct(
649#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B >= 7
650template <
class VALUE,
class ALLOCATOR>
651template <
class Args_01,
660BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
672 AllocatorTraits::construct(
687#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B >= 8
688template <
class VALUE,
class ALLOCATOR>
689template <
class Args_01,
699BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
712 AllocatorTraits::construct(
728#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B >= 9
729template <
class VALUE,
class ALLOCATOR>
730template <
class Args_01,
741BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
755 AllocatorTraits::construct(
772#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B >= 10
773template <
class VALUE,
class ALLOCATOR>
774template <
class Args_01,
786BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
801 AllocatorTraits::construct(
822template <
class VALUE,
class ALLOCATOR>
823template <
class... Args>
826BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
832 AllocatorTraits::construct(
842template <
class VALUE,
class ALLOCATOR>
845BidirectionalNodePool<VALUE, ALLOCATOR>::moveIntoNewNode(
848 return emplaceIntoNewNode(MoveUtil::move(
852template <
class VALUE,
class ALLOCATOR>
853void BidirectionalNodePool<VALUE, ALLOCATOR>::deleteNode(
860 AllocatorTraits::destroy(allocator(),
862 d_pool.deallocate(node);
865template <
class VALUE,
class ALLOCATOR>
867void BidirectionalNodePool<VALUE, ALLOCATOR>::release()
872template <
class VALUE,
class ALLOCATOR>
874void BidirectionalNodePool<VALUE, ALLOCATOR>::reserveNodes(size_type numNodes)
878 d_pool.reserve(numNodes);
881template <
class VALUE,
class ALLOCATOR>
883void BidirectionalNodePool<VALUE, ALLOCATOR>::swapRetainAllocators(
884 BidirectionalNodePool<VALUE, ALLOCATOR>& other)
888 d_pool.quickSwapRetainAllocators(other.d_pool);
891template <
class VALUE,
class ALLOCATOR>
893void BidirectionalNodePool<VALUE, ALLOCATOR>::swapExchangeAllocators(
894 BidirectionalNodePool<VALUE, ALLOCATOR>& other)
896 d_pool.quickSwapExchangeAllocators(other.d_pool);
900template <
class VALUE,
class ALLOCATOR>
903 SimplePool<bslalg::BidirectionalNode<VALUE>, ALLOCATOR>::
905BidirectionalNodePool<VALUE, ALLOCATOR>::allocator()
const
907 return d_pool.allocator();
912template <
class VALUE,
class ALLOCATOR>
923# error Not valid except when included from bslstl_bidirectionalnodepool.h
Definition bslalg_bidirectionallink.h:346
Definition bslalg_bidirectionalnode.h:357
ValueType & value()
Definition bslalg_bidirectionalnode.h:404
Definition bslma_deallocatorproctor.h:312
Definition bslmf_movableref.h:751
Definition bslstl_bidirectionalnodepool.h:270
void release()
Definition bslstl_bidirectionalnodepool.h:531
bslalg::BidirectionalLink * cloneNode(const bslalg::BidirectionalLink &original)
Definition bslstl_bidirectionalnodepool.h:479
AllocatorType & allocator()
Definition bslstl_bidirectionalnodepool.h:471
void adopt(bslmf::MovableRef< BidirectionalNodePool > pool)
Definition bslstl_bidirectionalnodepool.h:460
void swapRetainAllocators(BidirectionalNodePool &other)
Definition bslstl_bidirectionalnodepool.h:547
bslalg::BidirectionalLink * emplaceIntoNewNode(Args &&... arguments)
Definition bslstl_bidirectionalnodepool.h:491
AllocatorTraits::size_type size_type
Alias for the size_type of the allocator defined by SimplePool.
Definition bslstl_bidirectionalnodepool.h:300
~BidirectionalNodePool()=default
void swapExchangeAllocators(BidirectionalNodePool &other)
Definition bslstl_bidirectionalnodepool.h:557
Pool::AllocatorType AllocatorType
Alias for the allocator type defined by SimplePool.
Definition bslstl_bidirectionalnodepool.h:297
void deleteNode(bslalg::BidirectionalLink *linkNode)
Definition bslstl_bidirectionalnodepool.h:517
bslalg::BidirectionalLink * moveIntoNewNode(bslalg::BidirectionalLink *original)
Definition bslstl_bidirectionalnodepool.h:509
void reserveNodes(size_type numNodes)
Definition bslstl_bidirectionalnodepool.h:538
Types::AllocatorType AllocatorType
Definition bslstl_simplepool.h:341
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_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2012
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2018
void swap(OptionValue &a, OptionValue &b)
Definition bdlbb_blob.h:576
Definition bslstl_algorithm.h:82
void swap(BidirectionalNodePool< VALUE, ALLOCATOR > &a, BidirectionalNodePool< VALUE, ALLOCATOR > &b)
Definition bslmf_integralconstant.h:244
Definition bslmf_movableref.h:791
static TYPE * addressOf(TYPE &obj)
Definition bsls_util.h:305