11#ifndef INCLUDED_BSLMA_ALLOCATORUTIL_CPP03
12#define INCLUDED_BSLMA_ALLOCATORUTIL_CPP03
63#ifdef COMPILING_BSLMA_ALLOCATORUTIL_H
69template <
class t_ALLOCATOR,
class t_TYPE =
char>
70struct AllocatorUtil_Traits;
84 template <
class t_TYPE>
86 static long matchBslAlloc(
void *, ...);
93 template <
class t_TYPE>
95 void *allocateBytesImp(
98 std::size_t alignment);
99 template <
class t_TYPE>
103 std::size_t alignment);
104 template <
class t_ALLOCATOR>
106 typename AllocatorUtil_Traits<t_ALLOCATOR>::void_pointer
107 allocateBytesImp(
const t_ALLOCATOR& allocator,
109 std::size_t alignment);
116 template <
class t_TYPE>
121 std::size_t alignment);
122 template <
class t_TYPE>
127 std::size_t alignment);
128 template <
class t_ALLOCATOR>
129 static void deallocateBytesImp(
130 const t_ALLOCATOR& allocator,
131 typename AllocatorUtil_Traits<t_ALLOCATOR>::void_pointer p,
133 std::size_t alignment);
135 template <
class t_ALLOCATOR,
class t_POINTER,
class t_VALUE_TYPE>
136 static void deallocateObjectImp(
const t_ALLOCATOR& allocator,
139 const t_VALUE_TYPE& );
141 template <
class t_ALLOCATOR,
class t_POINTER,
class t_VALUE_TYPE>
142 static void deleteObjectImp(
const t_ALLOCATOR& allocator,
144 const t_VALUE_TYPE& );
148 static bool isPowerOf2(std::size_t alignment);
155 template <
class t_ALLOC>
156 struct IsDerivedFromBslAllocator
158 1 == sizeof(matchBslAlloc((t_ALLOC *) 0, 0))>
170 template <
class t_ALLOC>
174 adapt(
const t_ALLOC& from);
175 template <
class t_TYPE>
187 template <
class t_ALLOCATOR>
188 static typename AllocatorUtil_Traits<t_ALLOCATOR>::void_pointer
191 std::size_t alignment = k_MAX_ALIGNMENT);
200 template <
class t_TYPE,
class t_ALLOCATOR>
201 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
215 template <
class t_TYPE>
216 static t_TYPE&
assign(t_TYPE *lhs,
219 template <
class t_TYPE>
220 static t_TYPE&
assign(t_TYPE *lhs,
229 template <
class t_ALLOCATOR>
231 const t_ALLOCATOR& allocator,
232 typename AllocatorUtil_Traits<t_ALLOCATOR>::void_pointer p,
234 std::size_t alignment
244 template <
class t_ALLOCATOR,
class t_POINTER>
253 template <
class t_ALLOCATOR,
class t_POINTER>
254 static void deleteObject(
const t_ALLOCATOR& allocator, t_POINTER p);
261 template <
class t_TYPE,
class t_ALLOCATOR>
262 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
265#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
268#ifndef BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT
269#define BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT 13
271#ifndef BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A
272#define BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT
274# ifndef BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES
275#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 0
276 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1>
277 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
282#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 1
283 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01>
284 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
290#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 2
291 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
293 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
300#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 3
301 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
304 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
312#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 4
313 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
317 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
326#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 5
327 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
332 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
342#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 6
343 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
349 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
360#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 7
361 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
368 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
380#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 8
381 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
389 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
402#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 9
403 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
412 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
426#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 10
427 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
437 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
452#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 11
453 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
464 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
480#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 12
481 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
493 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
510#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 13
511 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
524 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
544#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 0
545 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1>
546 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
551#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 1
552 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01>
553 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
559#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 2
560 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
562 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
569#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 3
570 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
573 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
581#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 4
582 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
586 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
595#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 5
596 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
601 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
611#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 6
612 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
618 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
629#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 7
630 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
637 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
649#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 8
650 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
658 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
671#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 9
672 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
681 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
695#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 10
696 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
706 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
721#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 11
722 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
733 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
749#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 12
750 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
762 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
779#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 13
780 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
793 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
814# ifndef BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES
815 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class... t_ARGS>
816 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
822 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class... t_ARGS>
823 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
841 template <
class t_TYPE>
843 template <
class t_TYPE>
866template <
class t_ALLOCATOR,
class t_TYPE>
867struct AllocatorUtil_Traits
879template <
class t_MEMORY_RSRC,
class t_TYPE>
900template <
class t_TYPE>
902void *AllocatorUtil::allocateBytesImp(
905 std::size_t alignment)
910template <
class t_TYPE>
914 std::size_t alignment)
919template <
class t_ALLOCATOR>
920typename AllocatorUtil_Traits<t_ALLOCATOR>::void_pointer
921AllocatorUtil::allocateBytesImp(
const t_ALLOCATOR& allocator,
923 std::size_t alignment)
925 BSLMF_ASSERT(4 <= k_MAX_ALIGNMENT && k_MAX_ALIGNMENT <= 32);
927 static const int k_8 = k_MAX_ALIGNMENT < 8 ? k_MAX_ALIGNMENT : 8;
928 static const int k_16 = k_MAX_ALIGNMENT < 16 ? k_MAX_ALIGNMENT : 16;
937 if (alignment > k_MAX_ALIGNMENT) {
938 alignment = k_MAX_ALIGNMENT;
941 std::size_t n = (nbytes + alignment - 1) / alignment;
944 case 1:
return allocateObject<AlignType1 >(allocator, n);
945 case 2:
return allocateObject<AlignType2 >(allocator, n);
946 case 4:
return allocateObject<AlignType4 >(allocator, n);
947 case 8:
return allocateObject<AlignType8 >(allocator, n);
948 case 16:
return allocateObject<AlignType16 >(allocator, n);
949 default:
return allocateObject<AlignTypeMax>(allocator, n);
953template <
class t_TYPE>
955void AllocatorUtil::deallocateBytesImp(
959 std::size_t alignment)
964template <
class t_TYPE>
966void AllocatorUtil::deallocateBytesImp(
970 std::size_t alignment)
975template <
class t_ALLOCATOR>
976void AllocatorUtil::deallocateBytesImp(
977 const t_ALLOCATOR& allocator,
978 typename AllocatorUtil_Traits<t_ALLOCATOR>::void_pointer p,
980 std::size_t alignment)
982 BSLMF_ASSERT(4 <= k_MAX_ALIGNMENT && k_MAX_ALIGNMENT <= 32);
984 static const int k_8 = k_MAX_ALIGNMENT < 8 ? k_MAX_ALIGNMENT : 8;
985 static const int k_16 = k_MAX_ALIGNMENT < 16 ? k_MAX_ALIGNMENT : 16;
994 typedef typename AllocatorUtil_Traits<t_ALLOCATOR,
995 AlignType1 >::pointer Ptr1;
996 typedef typename AllocatorUtil_Traits<t_ALLOCATOR,
997 AlignType2 >::pointer Ptr2;
998 typedef typename AllocatorUtil_Traits<t_ALLOCATOR,
999 AlignType4 >::pointer Ptr4;
1000 typedef typename AllocatorUtil_Traits<t_ALLOCATOR,
1001 AlignType8 >::pointer Ptr8;
1002 typedef typename AllocatorUtil_Traits<t_ALLOCATOR,
1003 AlignType16 >::pointer Ptr16;
1004 typedef typename AllocatorUtil_Traits<t_ALLOCATOR,
1005 AlignTypeMax>::pointer PtrMax;
1007 if (alignment > k_MAX_ALIGNMENT) {
1008 alignment = k_MAX_ALIGNMENT;
1011 std::size_t n = (nbytes + alignment - 1) / alignment;
1013 switch (alignment) {
1023template <
class t_ALLOCATOR,
class t_POINTER,
class t_VALUE_TYPE>
1025void AllocatorUtil::deallocateObjectImp(
const t_ALLOCATOR& allocator,
1028 const t_VALUE_TYPE& )
1030 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_VALUE_TYPE> Traits;
1034 typename Traits::allocator_type reboundAlloc(allocator);
1035 reboundAlloc.deallocate(p, n);
1038template <
class t_ALLOCATOR,
class t_POINTER,
class t_VALUE_TYPE>
1040void AllocatorUtil::deleteObjectImp(
const t_ALLOCATOR& allocator,
1042 const t_VALUE_TYPE& )
1044 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_VALUE_TYPE> Traits;
1048 typename Traits::allocator_type reboundAlloc(allocator);
1050 reboundAlloc.deallocate(p, 1);
1054bool AllocatorUtil::isPowerOf2(std::size_t alignment)
1056 return (0 < alignment) && (0 == (alignment & (alignment - 1)));
1061template <
class t_ALLOC>
1071template <
class t_TYPE>
1078template <
class t_ALLOCATOR>
1080typename AllocatorUtil_Traits<t_ALLOCATOR>::void_pointer
1083 std::size_t alignment)
1088 typename AllocatorUtil_Traits<t_ALLOCATOR>::allocator_type StdAlloc;
1089 return allocateBytesImp(StdAlloc(allocator), nbytes, alignment);
1092template <
class t_TYPE,
class t_ALLOCATOR>
1094typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1097 typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::allocator_type
1098 reboundAlloc(allocator);
1099 return reboundAlloc.allocate(n);
1102template <
class t_TYPE>
1111template <
class t_TYPE>
1119template <
class t_ALLOCATOR>
1122 const t_ALLOCATOR& allocator,
1123 typename AllocatorUtil_Traits<t_ALLOCATOR>::void_pointer p,
1125 std::size_t alignment)
1130 typename AllocatorUtil_Traits<t_ALLOCATOR>::allocator_type StdAlloc;
1131 deallocateBytesImp(StdAlloc(allocator), p, nbytes, alignment);
1134template <
class t_ALLOCATOR,
class t_POINTER>
1141 deallocateObjectImp(allocator, p, n, *p);
1144template <
class t_ALLOCATOR,
class t_POINTER>
1149 deleteObjectImp(allocator, p, *p);
1152template <
class t_TYPE,
class t_ALLOCATOR>
1154typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1157 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1159 typename Traits::allocator_type reboundAlloc(allocator);
1160 typename Traits::pointer p = reboundAlloc.allocate(1);
1168 reboundAlloc.deallocate(p, 1);
1174#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1177#ifndef BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT
1178#define BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT 13
1180#ifndef BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B
1181#define BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT
1183# ifndef BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES
1184#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 0
1185template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1>
1187typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1191 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1193 typename Traits::allocator_type reboundAlloc(allocator);
1194 typename Traits::pointer p = reboundAlloc.allocate(1);
1196 Traits::construct(reboundAlloc,
1201 reboundAlloc.deallocate(p, 1);
1208#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 1
1209template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01>
1211typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1216 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1218 typename Traits::allocator_type reboundAlloc(allocator);
1219 typename Traits::pointer p = reboundAlloc.allocate(1);
1221 Traits::construct(reboundAlloc,
1227 reboundAlloc.deallocate(p, 1);
1234#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 2
1235template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1238typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1244 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1246 typename Traits::allocator_type reboundAlloc(allocator);
1247 typename Traits::pointer p = reboundAlloc.allocate(1);
1249 Traits::construct(reboundAlloc,
1256 reboundAlloc.deallocate(p, 1);
1263#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 3
1264template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1268typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1275 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1277 typename Traits::allocator_type reboundAlloc(allocator);
1278 typename Traits::pointer p = reboundAlloc.allocate(1);
1280 Traits::construct(reboundAlloc,
1288 reboundAlloc.deallocate(p, 1);
1295#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 4
1296template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1301typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1309 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1311 typename Traits::allocator_type reboundAlloc(allocator);
1312 typename Traits::pointer p = reboundAlloc.allocate(1);
1314 Traits::construct(reboundAlloc,
1323 reboundAlloc.deallocate(p, 1);
1330#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 5
1331template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1337typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1346 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1348 typename Traits::allocator_type reboundAlloc(allocator);
1349 typename Traits::pointer p = reboundAlloc.allocate(1);
1351 Traits::construct(reboundAlloc,
1361 reboundAlloc.deallocate(p, 1);
1368#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 6
1369template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1376typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1386 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1388 typename Traits::allocator_type reboundAlloc(allocator);
1389 typename Traits::pointer p = reboundAlloc.allocate(1);
1391 Traits::construct(reboundAlloc,
1402 reboundAlloc.deallocate(p, 1);
1409#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 7
1410template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1418typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1429 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1431 typename Traits::allocator_type reboundAlloc(allocator);
1432 typename Traits::pointer p = reboundAlloc.allocate(1);
1434 Traits::construct(reboundAlloc,
1446 reboundAlloc.deallocate(p, 1);
1453#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 8
1454template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1463typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1475 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1477 typename Traits::allocator_type reboundAlloc(allocator);
1478 typename Traits::pointer p = reboundAlloc.allocate(1);
1480 Traits::construct(reboundAlloc,
1493 reboundAlloc.deallocate(p, 1);
1500#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 9
1501template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1511typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1524 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1526 typename Traits::allocator_type reboundAlloc(allocator);
1527 typename Traits::pointer p = reboundAlloc.allocate(1);
1529 Traits::construct(reboundAlloc,
1543 reboundAlloc.deallocate(p, 1);
1550#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 10
1551template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1562typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1576 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1578 typename Traits::allocator_type reboundAlloc(allocator);
1579 typename Traits::pointer p = reboundAlloc.allocate(1);
1581 Traits::construct(reboundAlloc,
1596 reboundAlloc.deallocate(p, 1);
1603#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 11
1604template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1616typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1631 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1633 typename Traits::allocator_type reboundAlloc(allocator);
1634 typename Traits::pointer p = reboundAlloc.allocate(1);
1636 Traits::construct(reboundAlloc,
1652 reboundAlloc.deallocate(p, 1);
1659#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 12
1660template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1673typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1689 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1691 typename Traits::allocator_type reboundAlloc(allocator);
1692 typename Traits::pointer p = reboundAlloc.allocate(1);
1694 Traits::construct(reboundAlloc,
1711 reboundAlloc.deallocate(p, 1);
1718#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 13
1719template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1733typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1750 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1752 typename Traits::allocator_type reboundAlloc(allocator);
1753 typename Traits::pointer p = reboundAlloc.allocate(1);
1755 Traits::construct(reboundAlloc,
1773 reboundAlloc.deallocate(p, 1);
1782#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 0
1783template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1>
1785typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1789 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1791 typename Traits::allocator_type reboundAlloc(allocator);
1792 typename Traits::pointer p = reboundAlloc.allocate(1);
1794 Traits::construct(reboundAlloc,
1799 reboundAlloc.deallocate(p, 1);
1806#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 1
1807template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01>
1809typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1814 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1816 typename Traits::allocator_type reboundAlloc(allocator);
1817 typename Traits::pointer p = reboundAlloc.allocate(1);
1819 Traits::construct(reboundAlloc,
1825 reboundAlloc.deallocate(p, 1);
1832#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 2
1833template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1836typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1842 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1844 typename Traits::allocator_type reboundAlloc(allocator);
1845 typename Traits::pointer p = reboundAlloc.allocate(1);
1847 Traits::construct(reboundAlloc,
1854 reboundAlloc.deallocate(p, 1);
1861#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 3
1862template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1866typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1873 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1875 typename Traits::allocator_type reboundAlloc(allocator);
1876 typename Traits::pointer p = reboundAlloc.allocate(1);
1878 Traits::construct(reboundAlloc,
1886 reboundAlloc.deallocate(p, 1);
1893#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 4
1894template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1899typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1907 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1909 typename Traits::allocator_type reboundAlloc(allocator);
1910 typename Traits::pointer p = reboundAlloc.allocate(1);
1912 Traits::construct(reboundAlloc,
1921 reboundAlloc.deallocate(p, 1);
1928#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 5
1929template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1935typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1944 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1946 typename Traits::allocator_type reboundAlloc(allocator);
1947 typename Traits::pointer p = reboundAlloc.allocate(1);
1949 Traits::construct(reboundAlloc,
1959 reboundAlloc.deallocate(p, 1);
1966#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 6
1967template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1974typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1984 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1986 typename Traits::allocator_type reboundAlloc(allocator);
1987 typename Traits::pointer p = reboundAlloc.allocate(1);
1989 Traits::construct(reboundAlloc,
2000 reboundAlloc.deallocate(p, 1);
2007#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 7
2008template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
2016typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
2027 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
2029 typename Traits::allocator_type reboundAlloc(allocator);
2030 typename Traits::pointer p = reboundAlloc.allocate(1);
2032 Traits::construct(reboundAlloc,
2044 reboundAlloc.deallocate(p, 1);
2051#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 8
2052template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
2061typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
2073 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
2075 typename Traits::allocator_type reboundAlloc(allocator);
2076 typename Traits::pointer p = reboundAlloc.allocate(1);
2078 Traits::construct(reboundAlloc,
2091 reboundAlloc.deallocate(p, 1);
2098#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 9
2099template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
2109typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
2122 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
2124 typename Traits::allocator_type reboundAlloc(allocator);
2125 typename Traits::pointer p = reboundAlloc.allocate(1);
2127 Traits::construct(reboundAlloc,
2141 reboundAlloc.deallocate(p, 1);
2148#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 10
2149template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
2160typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
2174 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
2176 typename Traits::allocator_type reboundAlloc(allocator);
2177 typename Traits::pointer p = reboundAlloc.allocate(1);
2179 Traits::construct(reboundAlloc,
2194 reboundAlloc.deallocate(p, 1);
2201#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 11
2202template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
2214typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
2229 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
2231 typename Traits::allocator_type reboundAlloc(allocator);
2232 typename Traits::pointer p = reboundAlloc.allocate(1);
2234 Traits::construct(reboundAlloc,
2250 reboundAlloc.deallocate(p, 1);
2257#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 12
2258template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
2271typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
2287 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
2289 typename Traits::allocator_type reboundAlloc(allocator);
2290 typename Traits::pointer p = reboundAlloc.allocate(1);
2292 Traits::construct(reboundAlloc,
2309 reboundAlloc.deallocate(p, 1);
2316#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 13
2317template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
2331typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
2348 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
2350 typename Traits::allocator_type reboundAlloc(allocator);
2351 typename Traits::pointer p = reboundAlloc.allocate(1);
2353 Traits::construct(reboundAlloc,
2371 reboundAlloc.deallocate(p, 1);
2381# ifndef BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES
2382template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class... t_ARGS>
2384typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
2389 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
2391 typename Traits::allocator_type reboundAlloc(allocator);
2392 typename Traits::pointer p = reboundAlloc.allocate(1);
2394 Traits::construct(reboundAlloc,
2400 reboundAlloc.deallocate(p, 1);
2407template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class... t_ARGS>
2409typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
2414 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
2416 typename Traits::allocator_type reboundAlloc(allocator);
2417 typename Traits::pointer p = reboundAlloc.allocate(1);
2419 Traits::construct(reboundAlloc,
2425 reboundAlloc.deallocate(p, 1);
2433template <
class t_TYPE>
2441template <
class t_TYPE>
2453# error Not valid except when included from bslma_allocatorutil.h
Definition bslma_bslallocator.h:580
BloombergLP::bslma::Allocator * mechanism() const
Definition bslma_bslallocator.h:1126
Definition bslma_memoryresource.h:441
BSLS_ANNOTATION_NODISCARD void * allocate(size_t bytes, size_t alignment=k_MAX_ALIGN)
Definition bslma_memoryresource.h:541
void deallocate(void *p, size_t bytes, size_t alignment=k_MAX_ALIGN)
Definition bslma_memoryresource.h:547
Definition bslma_polymorphicallocator.h:452
memory_resource * resource() const
Return the address of the memory resource supplied on construction.
Definition bslma_polymorphicallocator.h:1048
Definition bslma_allocator.h:457
#define BSLMF_ASSERT(expr)
Definition bslmf_assert.h:229
static const bool value
Definition bslmf_integralconstant.h:258
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1804
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2012
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2018
#define BSLS_CATCH(X)
Definition bsls_exceptionutil.h:372
#define BSLS_TRY
Definition bsls_exceptionutil.h:370
#define BSLS_RETHROW
Definition bsls_exceptionutil.h:378
#define BSLS_UTIL_ADDRESSOF(OBJ)
Definition bsls_util.h:289
Definition balxml_encoderoptions.h:68
void swap(TYPE &a, TYPE &b)
Definition bslma_allocatortraits.h:1061
Definition bslmf_conditional.h:120
Definition bslmf_enableif.h:525
Definition bslmf_integralconstant.h:244
Definition bslmf_isconst.h:144
Definition bslmf_isconvertible.h:867
Definition bslmf_issame.h:146
Definition bslmf_isvolatile.h:144
static bsl::enable_if<!IsDerivedFromBslAllocator< t_ALLOC >::value, t_ALLOC >::type adapt(const t_ALLOC &from)
Definition bslma_allocatorutil.h:856
static AllocatorUtil_Traits< t_ALLOCATOR, t_TYPE >::pointer newObject(const t_ALLOCATOR &allocator)
Definition bslma_allocatorutil.h:945
static AllocatorUtil_Traits< t_ALLOCATOR, t_TYPE >::pointer allocateObject(const t_ALLOCATOR &allocator, std::size_t n=1)
Definition bslma_allocatorutil.h:885
static void swap(t_TYPE *pa, t_TYPE *pb, bsl::false_type allowed)
Definition bslma_allocatorutil.h:1024
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 void deleteObject(const t_ALLOCATOR &allocator, t_POINTER p)
Definition bslma_allocatorutil.h:936
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 & assign(t_TYPE *lhs, const t_TYPE &rhs, bsl::true_type allowed)
Definition bslma_allocatorutil.h:903
static void deallocateObject(const t_ALLOCATOR &allocator, t_POINTER p, std::size_t n=1)
Definition bslma_allocatorutil.h:926
AlignmentImpPriorityToType< PRIORITY >::Type Type
Definition bsls_alignmenttotype.h:394
@ BSLS_MAX_ALIGNMENT
Definition bsls_alignmentutil.h:275