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);
170#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
173#ifndef BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT
174#define BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT 10
176#ifndef BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A
177#define BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT
179#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A >= 0
184#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A >= 1
185 template <
class Args_01>
190#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A >= 2
191 template <
class Args_01,
198#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A >= 3
199 template <
class Args_01,
208#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A >= 4
209 template <
class Args_01,
220#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A >= 5
221 template <
class Args_01,
234#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A >= 6
235 template <
class Args_01,
250#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A >= 7
251 template <
class Args_01,
268#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A >= 8
269 template <
class Args_01,
288#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A >= 9
289 template <
class Args_01,
310#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_A >= 10
311 template <
class Args_01,
337 template <
class... Args>
391template <
class VALUE,
class ALLOCATOR>
392void swap(BidirectionalNodePool<VALUE, ALLOCATOR>& a,
393 BidirectionalNodePool<VALUE, ALLOCATOR>& b);
407template <
class VALUE,
class ALLOCATOR>
408struct IsBitwiseMoveable<
bslstl::BidirectionalNodePool<VALUE, ALLOCATOR> >
421template <
class VALUE,
class ALLOCATOR>
423BidirectionalNodePool<VALUE, ALLOCATOR>::BidirectionalNodePool(
424 const ALLOCATOR& allocator)
429template <
class VALUE,
class ALLOCATOR>
431BidirectionalNodePool<VALUE, ALLOCATOR>::BidirectionalNodePool(
433: d_pool(MoveUtil::move(MoveUtil::access(original).d_pool))
438template <
class VALUE,
class ALLOCATOR>
440void BidirectionalNodePool<VALUE, ALLOCATOR>::adopt(
443 BidirectionalNodePool& lvalue = pool;
444 d_pool.adopt(MoveUtil::move(lvalue.d_pool));
447template <
class VALUE,
class ALLOCATOR>
450SimplePool<bslalg::BidirectionalNode<VALUE>, ALLOCATOR>::AllocatorType&
451BidirectionalNodePool<VALUE, ALLOCATOR>::allocator()
453 return d_pool.allocator();
456template <
class VALUE,
class ALLOCATOR>
459BidirectionalNodePool<VALUE, ALLOCATOR>::cloneNode(
462 return emplaceIntoNewNode(
466#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
469#ifndef BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT
470#define BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT 10
472#ifndef BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B
473#define BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT
475#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B >= 0
476template <
class VALUE,
class ALLOCATOR>
479BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
485 AllocatorTraits::construct(
493#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B >= 1
494template <
class VALUE,
class ALLOCATOR>
495template <
class Args_01>
498BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
504 AllocatorTraits::construct(
513#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B >= 2
514template <
class VALUE,
class ALLOCATOR>
515template <
class Args_01,
519BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
526 AllocatorTraits::construct(
536#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B >= 3
537template <
class VALUE,
class ALLOCATOR>
538template <
class Args_01,
543BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
551 AllocatorTraits::construct(
562#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B >= 4
563template <
class VALUE,
class ALLOCATOR>
564template <
class Args_01,
570BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
579 AllocatorTraits::construct(
591#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B >= 5
592template <
class VALUE,
class ALLOCATOR>
593template <
class Args_01,
600BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
610 AllocatorTraits::construct(
623#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B >= 6
624template <
class VALUE,
class ALLOCATOR>
625template <
class Args_01,
633BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
644 AllocatorTraits::construct(
658#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B >= 7
659template <
class VALUE,
class ALLOCATOR>
660template <
class Args_01,
669BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
681 AllocatorTraits::construct(
696#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B >= 8
697template <
class VALUE,
class ALLOCATOR>
698template <
class Args_01,
708BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
721 AllocatorTraits::construct(
737#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B >= 9
738template <
class VALUE,
class ALLOCATOR>
739template <
class Args_01,
750BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
764 AllocatorTraits::construct(
781#if BSLSTL_BIDIRECTIONALNODEPOOL_VARIADIC_LIMIT_B >= 10
782template <
class VALUE,
class ALLOCATOR>
783template <
class Args_01,
795BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
810 AllocatorTraits::construct(
831template <
class VALUE,
class ALLOCATOR>
832template <
class... Args>
835BidirectionalNodePool<VALUE, ALLOCATOR>::emplaceIntoNewNode(
841 AllocatorTraits::construct(
851template <
class VALUE,
class ALLOCATOR>
854BidirectionalNodePool<VALUE, ALLOCATOR>::moveIntoNewNode(
857 return emplaceIntoNewNode(MoveUtil::move(
861template <
class VALUE,
class ALLOCATOR>
862void BidirectionalNodePool<VALUE, ALLOCATOR>::deleteNode(
869 AllocatorTraits::destroy(allocator(),
871 d_pool.deallocate(node);
874template <
class VALUE,
class ALLOCATOR>
876void BidirectionalNodePool<VALUE, ALLOCATOR>::release()
881template <
class VALUE,
class ALLOCATOR>
883void BidirectionalNodePool<VALUE, ALLOCATOR>::reserveNodes(size_type numNodes)
887 d_pool.reserve(numNodes);
890template <
class VALUE,
class ALLOCATOR>
892void BidirectionalNodePool<VALUE, ALLOCATOR>::swapRetainAllocators(
893 BidirectionalNodePool<VALUE, ALLOCATOR>& other)
897 d_pool.quickSwapRetainAllocators(other.d_pool);
900template <
class VALUE,
class ALLOCATOR>
902void BidirectionalNodePool<VALUE, ALLOCATOR>::swapExchangeAllocators(
903 BidirectionalNodePool<VALUE, ALLOCATOR>& other)
905 d_pool.quickSwapExchangeAllocators(other.d_pool);
909template <
class VALUE,
class ALLOCATOR>
912 SimplePool<bslalg::BidirectionalNode<VALUE>, ALLOCATOR>::
914BidirectionalNodePool<VALUE, ALLOCATOR>::allocator()
const
916 return d_pool.allocator();
921template <
class VALUE,
class ALLOCATOR>
932# error Not valid except when included from bslstl_bidirectionalnodepool.h
Definition bslalg_bidirectionallink.h:347
Definition bslalg_bidirectionalnode.h:357
ValueType & value()
Definition bslalg_bidirectionalnode.h:404
Definition bslma_deallocatorproctor.h:312
Definition bslmf_movableref.h:752
Definition bslstl_bidirectionalnodepool.h:274
void release()
Definition bslstl_bidirectionalnodepool.h:545
bslalg::BidirectionalLink * cloneNode(const bslalg::BidirectionalLink &original)
Definition bslstl_bidirectionalnodepool.h:493
AllocatorType & allocator()
Definition bslstl_bidirectionalnodepool.h:485
void adopt(bslmf::MovableRef< BidirectionalNodePool > pool)
Definition bslstl_bidirectionalnodepool.h:474
void swapRetainAllocators(BidirectionalNodePool &other)
Definition bslstl_bidirectionalnodepool.h:561
bslalg::BidirectionalLink * emplaceIntoNewNode(Args &&... arguments)
Definition bslstl_bidirectionalnodepool.h:505
AllocatorTraits::size_type size_type
Alias for the size_type of the allocator defined by SimplePool.
Definition bslstl_bidirectionalnodepool.h:304
~BidirectionalNodePool()=default
void swapExchangeAllocators(BidirectionalNodePool &other)
Definition bslstl_bidirectionalnodepool.h:571
Pool::AllocatorType AllocatorType
Alias for the allocator type defined by SimplePool.
Definition bslstl_bidirectionalnodepool.h:301
void deleteNode(bslalg::BidirectionalLink *linkNode)
Definition bslstl_bidirectionalnodepool.h:531
bslalg::BidirectionalLink * moveIntoNewNode(bslalg::BidirectionalLink *original)
Definition bslstl_bidirectionalnodepool.h:523
void reserveNodes(size_type numNodes)
Definition bslstl_bidirectionalnodepool.h:552
Types::AllocatorType AllocatorType
Definition bslstl_simplepool.h:343
Types::AllocatorTraits AllocatorTraits
Definition bslstl_simplepool.h:347
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1976
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1917
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2343
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2349
void swap(OptionValue &a, OptionValue &b)
Definition bdlbb_blob.h:579
Definition bslstl_algorithm.h:84
void swap(BidirectionalNodePool< VALUE, ALLOCATOR > &a, BidirectionalNodePool< VALUE, ALLOCATOR > &b)
Definition bslmf_integralconstant.h:261
Definition bslmf_movableref.h:795
static TYPE * addressOf(TYPE &obj)
Definition bsls_util.h:312