11#ifndef INCLUDED_BSLMA_POLYMORPHICALLOCATOR_CPP03
12#define INCLUDED_BSLMA_POLYMORPHICALLOCATOR_CPP03
63#ifdef COMPILING_BSLMA_POLYMORPHICALLOCATOR_H
65#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_PMR
68# include <memory_resource>
73template <
class TYPE = std::
byte>
74using polymorphic_allocator = std::pmr::polymorphic_allocator<TYPE>;
94#if defined(BSLS_PLATFORM_CMP_MSVC)
110struct PolymorphicAllocator_Unique
115#define BSLMF_POLYMORPHICALLOCATOR_NODEDUCE_T(VAL_T) \
116 std::pmr::polymorphic_allocator< \
117 BloombergLP::bslma::PolymorphicAllocator_Unique>
121#define BSLMF_POLYMORPHICALLOCATOR_NODEDUCE_T(VAL_T) \
122 typename bsl::type_identity<std::pmr::polymorphic_allocator<VAL_T>>::type
133bool operator==(
const polymorphic_allocator<TYPE>& a,
134 const BSLMF_POLYMORPHICALLOCATOR_NODEDUCE_T(TYPE)& b)
140bool operator==(
const BSLMF_POLYMORPHICALLOCATOR_NODEDUCE_T(TYPE)& a,
141 const polymorphic_allocator<TYPE>& b)
147bool operator!=(
const polymorphic_allocator<TYPE>& a,
148 const BSLMF_POLYMORPHICALLOCATOR_NODEDUCE_T(TYPE)& b)
154bool operator!=(
const BSLMF_POLYMORPHICALLOCATOR_NODEDUCE_T(TYPE)& a,
155 const polymorphic_allocator<TYPE>& b)
178template <
class TYPE =
unsigned char>
179class polymorphic_allocator {
182 memory_resource *d_resource;
207 template <
class ANY_TYPE>
209 typedef polymorphic_allocator<ANY_TYPE>
other;
243#ifdef BSLS_COMPILERFEATURES_SUPPORT_DEFAULTED_FUNCTIONS
250 template<
class ANY_TYPE>
266#ifndef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
294 template <
class ELEMENT_TYPE>
312#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
315#ifndef BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT
316#define BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT 14
318#ifndef BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A
319#define BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT
321#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 0
322 template <
class ELEMENT_TYPE,
class ARG1>
327#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 1
328 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01>
334#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 2
335 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
343#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 3
344 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
354#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 4
355 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
367#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 5
368 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
382#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 6
383 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
399#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 7
400 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
418#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 8
419 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
439#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 9
440 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
462#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 10
463 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
487#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 11
488 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
514#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 12
515 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
543#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 13
544 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
574#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 14
575 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
607#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 0
608 template <
class ELEMENT_TYPE,
class ARG1>
613#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 1
614 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01>
620#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 2
621 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
629#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 3
630 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
640#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 4
641 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
653#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 5
654 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
668#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 6
669 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
685#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 7
686 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
704#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 8
705 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
725#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 9
726 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
748#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 10
749 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
773#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 11
774 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
800#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 12
801 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
829#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 13
830 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
860#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_A >= 14
861 template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
896 template <
class ELEMENT_TYPE,
class ARG1,
class... ARGS>
900 template <
class ELEMENT_TYPE,
class ARG1,
class... ARGS>
909 template <
class ELEMENT_TYPE>
950 return a.resource() == b.resource() || *a.resource() == *b.resource();
968 return a.resource() != b.resource() && *a.resource() != *b.resource();
980template <
class T1,
class T2>
981bool operator==(
const polymorphic_allocator<T1>& a,
990template <
class T1,
class T2>
991bool operator!=(
const polymorphic_allocator<T1>& a,
1008template <
class TYPE>
1009struct allocator_traits<polymorphic_allocator<TYPE> > {
1022#ifdef BSLS_COMPILERFEATURES_SUPPORT_ALIAS_TEMPLATES
1023 template <
class TYPE2>
1024 using rebind_alloc = polymorphic_allocator<TYPE2>;
1026 template <
class TYPE2>
1027 using rebind_traits = allocator_traits<polymorphic_allocator<TYPE2> >;
1029 template <
class TYPE2>
1030 struct rebind_alloc : polymorphic_allocator<TYPE2> {
1032 : polymorphic_allocator<TYPE2>()
1039 template <
typename ARG>
1041 : polymorphic_allocator<TYPE2>(allocatorArg)
1046 template <
class TYPE2>
1047 struct rebind_traits : allocator_traits<polymorphic_allocator<TYPE2> > {
1053 return m.allocate(n);
1060 return m.allocate(n);
1068 template <
class TYPE2>
1075#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1078#ifndef BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT
1079#define BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT 14
1081#ifndef BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B
1082#define BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT
1084#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 0
1085 template <
class TYPE2,
class ARG1>
1095#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 1
1096 template <
class TYPE2,
class ARG1,
class ARGS_01>
1108#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 2
1109 template <
class TYPE2,
class ARG1,
class ARGS_01,
1124#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 3
1125 template <
class TYPE2,
class ARG1,
class ARGS_01,
1143#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 4
1144 template <
class TYPE2,
class ARG1,
class ARGS_01,
1165#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 5
1166 template <
class TYPE2,
class ARG1,
class ARGS_01,
1190#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 6
1191 template <
class TYPE2,
class ARG1,
class ARGS_01,
1218#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 7
1219 template <
class TYPE2,
class ARG1,
class ARGS_01,
1249#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 8
1250 template <
class TYPE2,
class ARG1,
class ARGS_01,
1283#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 9
1284 template <
class TYPE2,
class ARG1,
class ARGS_01,
1320#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 10
1321 template <
class TYPE2,
class ARG1,
class ARGS_01,
1360#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 11
1361 template <
class TYPE2,
class ARG1,
class ARGS_01,
1403#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 12
1404 template <
class TYPE2,
class ARG1,
class ARGS_01,
1449#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 13
1450 template <
class TYPE2,
class ARG1,
class ARGS_01,
1498#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 14
1499 template <
class TYPE2,
class ARG1,
class ARGS_01,
1551#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 0
1552 template <
class TYPE2,
class ARG1>
1562#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 1
1563 template <
class TYPE2,
class ARG1,
class ARGS_01>
1575#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 2
1576 template <
class TYPE2,
class ARG1,
class ARGS_01,
1591#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 3
1592 template <
class TYPE2,
class ARG1,
class ARGS_01,
1610#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 4
1611 template <
class TYPE2,
class ARG1,
class ARGS_01,
1632#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 5
1633 template <
class TYPE2,
class ARG1,
class ARGS_01,
1657#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 6
1658 template <
class TYPE2,
class ARG1,
class ARGS_01,
1685#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 7
1686 template <
class TYPE2,
class ARG1,
class ARGS_01,
1716#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 8
1717 template <
class TYPE2,
class ARG1,
class ARGS_01,
1750#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 9
1751 template <
class TYPE2,
class ARG1,
class ARGS_01,
1787#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 10
1788 template <
class TYPE2,
class ARG1,
class ARGS_01,
1827#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 11
1828 template <
class TYPE2,
class ARG1,
class ARGS_01,
1870#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 12
1871 template <
class TYPE2,
class ARG1,
class ARGS_01,
1916#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 13
1917 template <
class TYPE2,
class ARG1,
class ARGS_01,
1965#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_B >= 14
1966 template <
class TYPE2,
class ARG1,
class ARGS_01,
2020 template <
class TYPE2,
class ARG1,
class... ARGS>
2031 template <
class TYPE2,
class ARG1,
class... ARGS>
2044 template <
class TYPE2>
2086template <
class TYPE>
2087struct is_trivially_copyable<polymorphic_allocator<TYPE> > :
true_type { };
2095template <
class TYPE>
2103template <
class TYPE>
2112template <
class TYPE>
2119#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_PMR
2128template <
class TYPE>
2130bool std::pmr::operator==(
const std::pmr::polymorphic_allocator<TYPE>& a,
2131 const BSLMF_POLYMORPHICALLOCATOR_NODEDUCE_T(TYPE)& b)
2134 return a.resource() == b.resource() || *a.resource() == *b.resource();
2137template <
class TYPE>
2139bool std::pmr::operator==(
const BSLMF_POLYMORPHICALLOCATOR_NODEDUCE_T(TYPE)& a,
2140 const std::pmr::polymorphic_allocator<TYPE>& b)
2143 return a.resource() == b.resource() || *a.resource() == *b.resource();
2146template <
class TYPE>
2148bool std::pmr::operator!=(
const std::pmr::polymorphic_allocator<TYPE>& a,
2149 const BSLMF_POLYMORPHICALLOCATOR_NODEDUCE_T(TYPE)& b)
2152 return a.resource() != b.resource() && *a.resource() != *b.resource();
2155template <
class TYPE>
2157bool std::pmr::operator!=(
const BSLMF_POLYMORPHICALLOCATOR_NODEDUCE_T(TYPE)& a,
2158 const std::pmr::polymorphic_allocator<TYPE>& b)
2161 return a.resource() != b.resource() && *a.resource() != *b.resource();
2173template <
class TYPE>
2175: d_resource(BloombergLP::
bslma::Default::defaultAllocator())
2179template <
class TYPE>
2187#ifndef BSLS_COMPILERFEATURES_SUPPORT_DEFAULTED_FUNCTIONS
2189template <
class TYPE>
2191polymorphic_allocator<TYPE>::
2193: d_resource(other.resource())
2198template <
class TYPE>
2199template<
class ANY_TYPE>
2201polymorphic_allocator<TYPE>::
2202polymorphic_allocator(
const polymorphic_allocator<ANY_TYPE>& other)
2204: d_resource(other.resource())
2209template <
class TYPE>
2211TYPE *polymorphic_allocator<TYPE>::allocate(std::size_t n)
2213 const size_t k_TYPE_ALIGNMENT =
2214 BloombergLP::bsls::AlignmentFromType<TYPE>::VALUE;
2216 if (n > this->max_size()) {
2217 BloombergLP::bsls::BslExceptionUtil::throwBadAlloc();
2220 return static_cast<TYPE *
>(d_resource->allocate(n *
sizeof(TYPE),
2224#ifndef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
2225template <
class TYPE>
2228polymorphic_allocator<TYPE>::allocate(std::size_t n,
const void * )
2230 return this->allocate(n);
2234template <
class TYPE>
2236void polymorphic_allocator<TYPE>::deallocate(TYPE *p, std::size_t n)
2238 const std::size_t k_TYPE_ALIGNMENT =
2239 BloombergLP::bsls::AlignmentFromType<TYPE>::VALUE;
2241 d_resource->deallocate(p, n *
sizeof(TYPE), k_TYPE_ALIGNMENT);
2244template <
class TYPE>
2245template <
class ELEMENT_TYPE>
2247void polymorphic_allocator<TYPE>::construct(ELEMENT_TYPE *address)
2249 BloombergLP::bslma::ConstructionUtil::construct(address, *
this);
2252#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
2255#ifndef BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT
2256#define BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT 14
2258#ifndef BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C
2259#define BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT
2261#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 0
2262template <
class TYPE>
2263template <
class ELEMENT_TYPE,
class ARG1>
2265void polymorphic_allocator<TYPE>::construct(ELEMENT_TYPE *address,
2268 BloombergLP::bslma::ConstructionUtil::construct(
2275#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 1
2276template <
class TYPE>
2277template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01>
2279void polymorphic_allocator<TYPE>::construct(ELEMENT_TYPE *address,
2283 BloombergLP::bslma::ConstructionUtil::construct(
2291#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 2
2292template <
class TYPE>
2293template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
2296void polymorphic_allocator<TYPE>::construct(ELEMENT_TYPE *address,
2301 BloombergLP::bslma::ConstructionUtil::construct(
2310#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 3
2311template <
class TYPE>
2312template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
2316void polymorphic_allocator<TYPE>::construct(ELEMENT_TYPE *address,
2322 BloombergLP::bslma::ConstructionUtil::construct(
2332#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 4
2333template <
class TYPE>
2334template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
2339void polymorphic_allocator<TYPE>::construct(ELEMENT_TYPE *address,
2346 BloombergLP::bslma::ConstructionUtil::construct(
2357#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 5
2358template <
class TYPE>
2359template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
2365void polymorphic_allocator<TYPE>::construct(ELEMENT_TYPE *address,
2373 BloombergLP::bslma::ConstructionUtil::construct(
2385#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 6
2386template <
class TYPE>
2387template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
2394void polymorphic_allocator<TYPE>::construct(ELEMENT_TYPE *address,
2403 BloombergLP::bslma::ConstructionUtil::construct(
2416#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 7
2417template <
class TYPE>
2418template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
2426void polymorphic_allocator<TYPE>::construct(ELEMENT_TYPE *address,
2436 BloombergLP::bslma::ConstructionUtil::construct(
2450#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 8
2451template <
class TYPE>
2452template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
2461void polymorphic_allocator<TYPE>::construct(ELEMENT_TYPE *address,
2472 BloombergLP::bslma::ConstructionUtil::construct(
2487#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 9
2488template <
class TYPE>
2489template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
2499void polymorphic_allocator<TYPE>::construct(ELEMENT_TYPE *address,
2511 BloombergLP::bslma::ConstructionUtil::construct(
2527#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 10
2528template <
class TYPE>
2529template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
2540void polymorphic_allocator<TYPE>::construct(ELEMENT_TYPE *address,
2553 BloombergLP::bslma::ConstructionUtil::construct(
2570#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 11
2571template <
class TYPE>
2572template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
2584void polymorphic_allocator<TYPE>::construct(ELEMENT_TYPE *address,
2598 BloombergLP::bslma::ConstructionUtil::construct(
2616#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 12
2617template <
class TYPE>
2618template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
2631void polymorphic_allocator<TYPE>::construct(ELEMENT_TYPE *address,
2646 BloombergLP::bslma::ConstructionUtil::construct(
2665#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 13
2666template <
class TYPE>
2667template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
2681void polymorphic_allocator<TYPE>::construct(ELEMENT_TYPE *address,
2697 BloombergLP::bslma::ConstructionUtil::construct(
2717#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 14
2718template <
class TYPE>
2719template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
2734void polymorphic_allocator<TYPE>::construct(ELEMENT_TYPE *address,
2751 BloombergLP::bslma::ConstructionUtil::construct(
2773#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 0
2774template <
class TYPE>
2775template <
class ELEMENT_TYPE,
class ARG1>
2777void polymorphic_allocator<TYPE>::construct(
2778 ELEMENT_TYPE *address,
2781 BloombergLP::bslma::ConstructionUtil::construct(
2788#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 1
2789template <
class TYPE>
2790template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01>
2792void polymorphic_allocator<TYPE>::construct(
2793 ELEMENT_TYPE *address,
2797 BloombergLP::bslma::ConstructionUtil::construct(
2805#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 2
2806template <
class TYPE>
2807template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
2810void polymorphic_allocator<TYPE>::construct(
2811 ELEMENT_TYPE *address,
2816 BloombergLP::bslma::ConstructionUtil::construct(
2825#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 3
2826template <
class TYPE>
2827template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
2831void polymorphic_allocator<TYPE>::construct(
2832 ELEMENT_TYPE *address,
2838 BloombergLP::bslma::ConstructionUtil::construct(
2848#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 4
2849template <
class TYPE>
2850template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
2855void polymorphic_allocator<TYPE>::construct(
2856 ELEMENT_TYPE *address,
2863 BloombergLP::bslma::ConstructionUtil::construct(
2874#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 5
2875template <
class TYPE>
2876template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
2882void polymorphic_allocator<TYPE>::construct(
2883 ELEMENT_TYPE *address,
2891 BloombergLP::bslma::ConstructionUtil::construct(
2903#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 6
2904template <
class TYPE>
2905template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
2912void polymorphic_allocator<TYPE>::construct(
2913 ELEMENT_TYPE *address,
2922 BloombergLP::bslma::ConstructionUtil::construct(
2935#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 7
2936template <
class TYPE>
2937template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
2945void polymorphic_allocator<TYPE>::construct(
2946 ELEMENT_TYPE *address,
2956 BloombergLP::bslma::ConstructionUtil::construct(
2970#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 8
2971template <
class TYPE>
2972template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
2981void polymorphic_allocator<TYPE>::construct(
2982 ELEMENT_TYPE *address,
2993 BloombergLP::bslma::ConstructionUtil::construct(
3008#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 9
3009template <
class TYPE>
3010template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
3020void polymorphic_allocator<TYPE>::construct(
3021 ELEMENT_TYPE *address,
3033 BloombergLP::bslma::ConstructionUtil::construct(
3049#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 10
3050template <
class TYPE>
3051template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
3062void polymorphic_allocator<TYPE>::construct(
3063 ELEMENT_TYPE *address,
3076 BloombergLP::bslma::ConstructionUtil::construct(
3093#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 11
3094template <
class TYPE>
3095template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
3107void polymorphic_allocator<TYPE>::construct(
3108 ELEMENT_TYPE *address,
3122 BloombergLP::bslma::ConstructionUtil::construct(
3140#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 12
3141template <
class TYPE>
3142template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
3155void polymorphic_allocator<TYPE>::construct(
3156 ELEMENT_TYPE *address,
3171 BloombergLP::bslma::ConstructionUtil::construct(
3190#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 13
3191template <
class TYPE>
3192template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
3206void polymorphic_allocator<TYPE>::construct(
3207 ELEMENT_TYPE *address,
3223 BloombergLP::bslma::ConstructionUtil::construct(
3243#if BSLMA_POLYMORPHICALLOCATOR_VARIADIC_LIMIT_C >= 14
3244template <
class TYPE>
3245template <
class ELEMENT_TYPE,
class ARG1,
class ARGS_01,
3260void polymorphic_allocator<TYPE>::construct(
3261 ELEMENT_TYPE *address,
3278 BloombergLP::bslma::ConstructionUtil::construct(
3302template <
class TYPE>
3303template <
class ELEMENT_TYPE,
class ARG1,
class... ARGS>
3305void polymorphic_allocator<TYPE>::construct(ELEMENT_TYPE *address,
3309 BloombergLP::bslma::ConstructionUtil::construct(
3316template <
class TYPE>
3317template <
class ELEMENT_TYPE,
class ARG1,
class... ARGS>
3319void polymorphic_allocator<TYPE>::construct(
3320 ELEMENT_TYPE *address,
3324 BloombergLP::bslma::ConstructionUtil::construct(
3333template <
class TYPE>
3334template <
class ELEMENT_TYPE>
3336void polymorphic_allocator<TYPE>::destroy(ELEMENT_TYPE *address)
3338 BloombergLP::bslma::DestructionUtil::destroy(address);
3343template <
class TYPE>
3345typename polymorphic_allocator<TYPE>::pointer
3346polymorphic_allocator<TYPE>::address(reference x)
const
3348 return BloombergLP::bsls::Util::addressOf(x);
3351template <
class TYPE>
3353typename polymorphic_allocator<TYPE>::const_pointer
3354polymorphic_allocator<TYPE>::address(const_reference x)
const
3356 return BloombergLP::bsls::Util::addressOf(x);
3359template <
class TYPE>
3361typename polymorphic_allocator<TYPE>::size_type
3362polymorphic_allocator<TYPE>::max_size()
const
3367 return (~size_type(0)) /
sizeof(TYPE);
3370template <
class TYPE>
3372memory_resource *polymorphic_allocator<TYPE>::resource()
const
3377template <
class TYPE>
3379polymorphic_allocator<TYPE>
3380polymorphic_allocator<TYPE>::select_on_container_copy_construction()
const
3382 return polymorphic_allocator();
3388template <
class T1,
class T2>
3394 return a.resource() == b.resource() || *a.resource() == *b.resource();
3397template <
class T1,
class T2>
3403 return a.resource() != b.resource() && *a.resource() != *b.resource();
3409# error Not valid except when included from bslma_polymorphicallocator.h
Definition bslma_polymorphicallocator.h:460
friend bool operator==(const polymorphic_allocator &a, const polymorphic_allocator &b) BSLS_KEYWORD_NOEXCEPT
Definition bslma_polymorphicallocator.h:644
BSLS_ANNOTATION_NODISCARD TYPE * allocate(std::size_t n)
Definition bslma_polymorphicallocator.h:963
memory_resource * resource() const
Return the address of the memory resource supplied on construction.
Definition bslma_polymorphicallocator.h:1074
TYPE * pointer
Definition bslma_polymorphicallocator.h:474
friend bool operator!=(const polymorphic_allocator &a, const polymorphic_allocator &b) BSLS_KEYWORD_NOEXCEPT
Definition bslma_polymorphicallocator.h:662
void construct(ELEMENT_TYPE *address)
Definition bslma_polymorphicallocator.h:999
~polymorphic_allocator()=default
const TYPE * const_pointer
Definition bslma_polymorphicallocator.h:475
polymorphic_allocator() BSLS_KEYWORD_NOEXCEPT
Definition bslma_polymorphicallocator.h:926
std::ptrdiff_t difference_type
Definition bslma_polymorphicallocator.h:473
TYPE & reference
Definition bslma_polymorphicallocator.h:476
std::size_t size_type
Definition bslma_polymorphicallocator.h:472
BSLS_KEYWORD_CONSTEXPR size_type max_size() const
Definition bslma_polymorphicallocator.h:1064
polymorphic_allocator select_on_container_copy_construction() const
Return a default-constructed polymorphic_allocator.
Definition bslma_polymorphicallocator.h:1082
TYPE value_type
Definition bslma_polymorphicallocator.h:478
void deallocate(TYPE *p, std::size_t n)
Definition bslma_polymorphicallocator.h:988
const TYPE & const_reference
Definition bslma_polymorphicallocator.h:477
pointer address(reference x) const
Definition bslma_polymorphicallocator.h:1048
void destroy(ELEMENT_TYPE *address)
Definition bslma_polymorphicallocator.h:1038
#define BSLS_ANNOTATION_NODISCARD
Definition bsls_annotation.h:368
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1976
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2343
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2349
#define BSLS_KEYWORD_CONSTEXPR
Definition bsls_keyword.h:624
#define BSLS_KEYWORD_DELETED
Definition bsls_keyword.h:651
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:674
bool operator!=(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
bool operator==(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
Definition bdlat_valuetypefunctions.h:939
integral_constant< bool, false > false_type
Definition bslmf_integralconstant.h:290
integral_constant< bool, true > true_type
Definition bslmf_integralconstant.h:296
bool operator==(const memory_resource &a, const memory_resource &b)
bool operator!=(const memory_resource &a, const memory_resource &b)
Definition baljsn_encoder_testtypes.h:76
Definition bdlbb_blob.h:579
rebind_alloc(const ARG &allocatorArg)
Definition bslma_allocatortraits.h:1224
static pointer allocate(ALLOCATOR_TYPE &basicAllocator, size_type n)
Return basicAllocator.allocate(n).
Definition bslma_allocatortraits.h:1494
BloombergLP::bslma::AllocatorTraits_ConstPointerType< ALLOCATOR_TYPE >::type const_pointer
Definition bslma_allocatortraits.h:1183
BloombergLP::bslma::AllocatorTraits_VoidPointerType< ALLOCATOR_TYPE >::type void_pointer
Definition bslma_allocatortraits.h:1186
BloombergLP::bslma::AllocatorTraits_PropOnCopyAssign< ALLOCATOR_TYPE >::type propagate_on_container_copy_assignment
Definition bslma_allocatortraits.h:1332
BloombergLP::bslma::AllocatorTraits_PropOnMoveAssign< ALLOCATOR_TYPE >::type propagate_on_container_move_assignment
Definition bslma_allocatortraits.h:1341
static ALLOCATOR_TYPE select_on_container_copy_construction(const ALLOCATOR_TYPE &rhs)
Definition bslma_allocatortraits.h:1587
BloombergLP::bslma::AllocatorTraits_SizeType< ALLOCATOR_TYPE >::type size_type
Definition bslma_allocatortraits.h:1196
static void construct(ALLOCATOR_TYPE &basicAllocator, ELEMENT_TYPE *elementAddr, Args &&... arguments)
Definition bslma_allocatortraits.h:1527
static size_type max_size(const ALLOCATOR_TYPE &basicAllocator) BSLS_KEYWORD_NOEXCEPT
Definition bslma_allocatortraits.h:1570
BloombergLP::bslma::AllocatorTraits_PointerType< ALLOCATOR_TYPE >::type pointer
Definition bslma_allocatortraits.h:1180
static void destroy(ALLOCATOR_TYPE &basicAllocator, ELEMENT_TYPE *elementAddr)
Definition bslma_allocatortraits.h:1549
BloombergLP::bslma::AllocatorTraits_IsAlwaysEqual< ALLOCATOR_TYPE >::type is_always_equal
Definition bslma_allocatortraits.h:1323
static void deallocate(ALLOCATOR_TYPE &basicAllocator, pointer elementAddr, size_type n)
Definition bslma_allocatortraits.h:1513
BloombergLP::bslma::AllocatorTraits_PropOnSwap< ALLOCATOR_TYPE >::type propagate_on_container_swap
Definition bslma_allocatortraits.h:1350
ALLOCATOR_TYPE allocator_type
Definition bslma_allocatortraits.h:1175
BloombergLP::bslma::AllocatorTraits_ConstVoidPointerType< ALLOCATOR_TYPE >::type const_void_pointer
Definition bslma_allocatortraits.h:1189
BloombergLP::bslma::AllocatorTraits_DifferenceType< ALLOCATOR_TYPE >::type difference_type
Definition bslma_allocatortraits.h:1193
ALLOCATOR_TYPE::value_type value_type
Definition bslma_allocatortraits.h:1176
polymorphic_allocator< ANY_TYPE > other
Definition bslma_polymorphicallocator.h:490