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;
86 template <
class t_TYPE>
88 static long matchBslAlloc(
void *, ...);
95 template <
class t_TYPE>
97 void *allocateBytesImp(
100 std::size_t alignment);
101 template <
class t_TYPE>
105 std::size_t alignment);
106 template <
class t_ALLOCATOR>
108 typename AllocatorUtil_Traits<t_ALLOCATOR>::void_pointer
109 allocateBytesImp(
const t_ALLOCATOR& allocator,
111 std::size_t alignment);
119 template <
class t_TYPE>
124 std::size_t alignment);
125 template <
class t_TYPE>
130 std::size_t alignment);
131 template <
class t_ALLOCATOR>
132 static void deallocateBytesImp(
133 const t_ALLOCATOR& allocator,
134 typename AllocatorUtil_Traits<t_ALLOCATOR>::void_pointer p,
136 std::size_t alignment);
138 template <
class t_ALLOCATOR,
class t_POINTER,
class t_VALUE_TYPE>
139 static void deallocateObjectImp(
const t_ALLOCATOR& allocator,
142 const t_VALUE_TYPE& );
144 template <
class t_ALLOCATOR,
class t_POINTER,
class t_VALUE_TYPE>
145 static void deleteObjectImp(
const t_ALLOCATOR& allocator,
147 const t_VALUE_TYPE& );
151 static bool isPowerOf2(std::size_t alignment);
158 template <
class t_ALLOC>
159 struct IsDerivedFromBslAllocator
161 1 == sizeof(matchBslAlloc((t_ALLOC *) 0, 0))>
173 template <
class t_ALLOC>
177 adapt(
const t_ALLOC& from);
178 template <
class t_TYPE>
192 template <
class t_ALLOCATOR>
193 static typename AllocatorUtil_Traits<t_ALLOCATOR>::void_pointer
196 std::size_t alignment = 0);
204 template <
class t_TYPE,
class t_ALLOCATOR>
205 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
220 template <
class t_TYPE>
221 static t_TYPE&
assign(t_TYPE *lhs,
224 template <
class t_TYPE>
225 static t_TYPE&
assign(t_TYPE *lhs,
237 template <
class t_ALLOCATOR>
239 const t_ALLOCATOR& allocator,
240 typename AllocatorUtil_Traits<t_ALLOCATOR>::void_pointer p,
242 std::size_t alignment =0);
252 template <
class t_ALLOCATOR,
class t_POINTER>
262 template <
class t_ALLOCATOR,
class t_POINTER>
263 static void deleteObject(
const t_ALLOCATOR& allocator, t_POINTER p);
270 template <
class t_TYPE,
class t_ALLOCATOR>
271 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
274#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
277#ifndef BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT
278#define BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT 13
280#ifndef BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A
281#define BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT
283# ifndef BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES
284#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 0
285 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1>
286 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
291#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 1
292 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01>
293 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
299#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 2
300 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
302 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
309#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 3
310 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
313 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
321#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 4
322 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
326 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
335#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 5
336 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
341 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
351#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 6
352 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
358 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
369#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 7
370 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
377 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
389#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 8
390 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
398 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
411#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 9
412 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
421 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
435#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 10
436 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
446 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
461#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 11
462 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
473 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
489#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 12
490 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
502 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
519#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 13
520 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
533 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
553#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 0
554 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1>
555 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
560#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 1
561 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01>
562 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
568#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 2
569 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
571 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
578#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 3
579 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
582 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
590#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 4
591 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
595 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
604#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 5
605 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
610 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
620#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 6
621 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
627 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
638#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 7
639 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
646 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
658#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 8
659 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
667 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
680#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 9
681 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
690 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
704#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 10
705 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
715 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
730#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 11
731 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
742 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
758#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 12
759 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
771 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
788#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_A >= 13
789 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
802 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
823# ifndef BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES
824 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class... t_ARGS>
825 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
831 template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class... t_ARGS>
832 static typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
850 template <
class t_TYPE>
852 template <
class t_TYPE>
875template <
class t_ALLOCATOR,
class t_TYPE>
876struct AllocatorUtil_Traits
888template <
class t_MEMORY_RSRC,
class t_TYPE>
909template <
class t_TYPE>
911void *AllocatorUtil::allocateBytesImp(
914 std::size_t alignment)
919template <
class t_TYPE>
923 std::size_t alignment)
928template <
class t_ALLOCATOR>
929typename AllocatorUtil_Traits<t_ALLOCATOR>::void_pointer
930AllocatorUtil::allocateBytesImp(
const t_ALLOCATOR& allocator,
932 std::size_t alignment)
934 BSLMF_ASSERT(4 <= k_MAX_ALIGNMENT && k_MAX_ALIGNMENT <= 32);
936 static const int k_8 = k_MAX_ALIGNMENT < 8 ? k_MAX_ALIGNMENT : 8;
937 static const int k_16 = k_MAX_ALIGNMENT < 16 ? k_MAX_ALIGNMENT : 16;
946 if (alignment > k_MAX_ALIGNMENT) {
947 alignment = k_MAX_ALIGNMENT;
950 std::size_t n = (nbytes + alignment - 1) / alignment;
953 case 1:
return allocateObject<AlignType1 >(allocator, n);
954 case 2:
return allocateObject<AlignType2 >(allocator, n);
955 case 4:
return allocateObject<AlignType4 >(allocator, n);
956 case 8:
return allocateObject<AlignType8 >(allocator, n);
957 case 16:
return allocateObject<AlignType16 >(allocator, n);
958 default:
return allocateObject<AlignTypeMax>(allocator, n);
962template <
class t_TYPE>
964void AllocatorUtil::deallocateBytesImp(
968 std::size_t alignment)
973template <
class t_TYPE>
975void AllocatorUtil::deallocateBytesImp(
979 std::size_t alignment)
984template <
class t_ALLOCATOR>
985void AllocatorUtil::deallocateBytesImp(
986 const t_ALLOCATOR& allocator,
987 typename AllocatorUtil_Traits<t_ALLOCATOR>::void_pointer p,
989 std::size_t alignment)
991 BSLMF_ASSERT(4 <= k_MAX_ALIGNMENT && k_MAX_ALIGNMENT <= 32);
993 static const int k_8 = k_MAX_ALIGNMENT < 8 ? k_MAX_ALIGNMENT : 8;
994 static const int k_16 = k_MAX_ALIGNMENT < 16 ? k_MAX_ALIGNMENT : 16;
1003 typedef typename AllocatorUtil_Traits<t_ALLOCATOR,
1004 AlignType1 >::pointer Ptr1;
1005 typedef typename AllocatorUtil_Traits<t_ALLOCATOR,
1006 AlignType2 >::pointer Ptr2;
1007 typedef typename AllocatorUtil_Traits<t_ALLOCATOR,
1008 AlignType4 >::pointer Ptr4;
1009 typedef typename AllocatorUtil_Traits<t_ALLOCATOR,
1010 AlignType8 >::pointer Ptr8;
1011 typedef typename AllocatorUtil_Traits<t_ALLOCATOR,
1012 AlignType16 >::pointer Ptr16;
1013 typedef typename AllocatorUtil_Traits<t_ALLOCATOR,
1014 AlignTypeMax>::pointer PtrMax;
1016 if (alignment > k_MAX_ALIGNMENT) {
1017 alignment = k_MAX_ALIGNMENT;
1020 std::size_t n = (nbytes + alignment - 1) / alignment;
1022 switch (alignment) {
1032template <
class t_ALLOCATOR,
class t_POINTER,
class t_VALUE_TYPE>
1034void AllocatorUtil::deallocateObjectImp(
const t_ALLOCATOR& allocator,
1037 const t_VALUE_TYPE& )
1039 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_VALUE_TYPE> Traits;
1043 typename Traits::allocator_type reboundAlloc(allocator);
1044 reboundAlloc.deallocate(p, n);
1047template <
class t_ALLOCATOR,
class t_POINTER,
class t_VALUE_TYPE>
1049void AllocatorUtil::deleteObjectImp(
const t_ALLOCATOR& allocator,
1051 const t_VALUE_TYPE& )
1053 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_VALUE_TYPE> Traits;
1057 typename Traits::allocator_type reboundAlloc(allocator);
1059 reboundAlloc.deallocate(p, 1);
1063bool AllocatorUtil::isPowerOf2(std::size_t alignment)
1065 return (0 < alignment) && (0 == (alignment & (alignment - 1)));
1070template <
class t_ALLOC>
1080template <
class t_TYPE>
1087template <
class t_ALLOCATOR>
1089typename AllocatorUtil_Traits<t_ALLOCATOR>::void_pointer
1092 std::size_t alignment)
1094 if (0 == alignment) {
1101 typename AllocatorUtil_Traits<t_ALLOCATOR>::allocator_type StdAlloc;
1102 return allocateBytesImp(StdAlloc(allocator), nbytes, alignment);
1105template <
class t_TYPE,
class t_ALLOCATOR>
1107typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1110 typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::allocator_type
1111 reboundAlloc(allocator);
1112 return reboundAlloc.allocate(n);
1115template <
class t_TYPE>
1124template <
class t_TYPE>
1132template <
class t_ALLOCATOR>
1135 const t_ALLOCATOR& allocator,
1136 typename AllocatorUtil_Traits<t_ALLOCATOR>::void_pointer p,
1138 std::size_t alignment)
1140 if (0 == alignment) {
1147 typename AllocatorUtil_Traits<t_ALLOCATOR>::allocator_type StdAlloc;
1148 deallocateBytesImp(StdAlloc(allocator), p, nbytes, alignment);
1151template <
class t_ALLOCATOR,
class t_POINTER>
1158 deallocateObjectImp(allocator, p, n, *p);
1161template <
class t_ALLOCATOR,
class t_POINTER>
1166 deleteObjectImp(allocator, p, *p);
1169template <
class t_TYPE,
class t_ALLOCATOR>
1171typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1174 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1176 typename Traits::allocator_type reboundAlloc(allocator);
1177 typename Traits::pointer p = reboundAlloc.allocate(1);
1185 reboundAlloc.deallocate(p, 1);
1191#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1194#ifndef BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT
1195#define BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT 13
1197#ifndef BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B
1198#define BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT
1200# ifndef BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES
1201#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 0
1202template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1>
1204typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1208 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1210 typename Traits::allocator_type reboundAlloc(allocator);
1211 typename Traits::pointer p = reboundAlloc.allocate(1);
1213 Traits::construct(reboundAlloc,
1218 reboundAlloc.deallocate(p, 1);
1225#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 1
1226template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01>
1228typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1233 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1235 typename Traits::allocator_type reboundAlloc(allocator);
1236 typename Traits::pointer p = reboundAlloc.allocate(1);
1238 Traits::construct(reboundAlloc,
1244 reboundAlloc.deallocate(p, 1);
1251#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 2
1252template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1255typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1261 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1263 typename Traits::allocator_type reboundAlloc(allocator);
1264 typename Traits::pointer p = reboundAlloc.allocate(1);
1266 Traits::construct(reboundAlloc,
1273 reboundAlloc.deallocate(p, 1);
1280#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 3
1281template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1285typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1292 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1294 typename Traits::allocator_type reboundAlloc(allocator);
1295 typename Traits::pointer p = reboundAlloc.allocate(1);
1297 Traits::construct(reboundAlloc,
1305 reboundAlloc.deallocate(p, 1);
1312#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 4
1313template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1318typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1326 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1328 typename Traits::allocator_type reboundAlloc(allocator);
1329 typename Traits::pointer p = reboundAlloc.allocate(1);
1331 Traits::construct(reboundAlloc,
1340 reboundAlloc.deallocate(p, 1);
1347#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 5
1348template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1354typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1363 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1365 typename Traits::allocator_type reboundAlloc(allocator);
1366 typename Traits::pointer p = reboundAlloc.allocate(1);
1368 Traits::construct(reboundAlloc,
1378 reboundAlloc.deallocate(p, 1);
1385#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 6
1386template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1393typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1403 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1405 typename Traits::allocator_type reboundAlloc(allocator);
1406 typename Traits::pointer p = reboundAlloc.allocate(1);
1408 Traits::construct(reboundAlloc,
1419 reboundAlloc.deallocate(p, 1);
1426#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 7
1427template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1435typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1446 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1448 typename Traits::allocator_type reboundAlloc(allocator);
1449 typename Traits::pointer p = reboundAlloc.allocate(1);
1451 Traits::construct(reboundAlloc,
1463 reboundAlloc.deallocate(p, 1);
1470#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 8
1471template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1480typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1492 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1494 typename Traits::allocator_type reboundAlloc(allocator);
1495 typename Traits::pointer p = reboundAlloc.allocate(1);
1497 Traits::construct(reboundAlloc,
1510 reboundAlloc.deallocate(p, 1);
1517#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 9
1518template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1528typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1541 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1543 typename Traits::allocator_type reboundAlloc(allocator);
1544 typename Traits::pointer p = reboundAlloc.allocate(1);
1546 Traits::construct(reboundAlloc,
1560 reboundAlloc.deallocate(p, 1);
1567#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 10
1568template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1579typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1593 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1595 typename Traits::allocator_type reboundAlloc(allocator);
1596 typename Traits::pointer p = reboundAlloc.allocate(1);
1598 Traits::construct(reboundAlloc,
1613 reboundAlloc.deallocate(p, 1);
1620#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 11
1621template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1633typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1648 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1650 typename Traits::allocator_type reboundAlloc(allocator);
1651 typename Traits::pointer p = reboundAlloc.allocate(1);
1653 Traits::construct(reboundAlloc,
1669 reboundAlloc.deallocate(p, 1);
1676#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 12
1677template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1690typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1706 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1708 typename Traits::allocator_type reboundAlloc(allocator);
1709 typename Traits::pointer p = reboundAlloc.allocate(1);
1711 Traits::construct(reboundAlloc,
1728 reboundAlloc.deallocate(p, 1);
1735#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 13
1736template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1750typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1767 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1769 typename Traits::allocator_type reboundAlloc(allocator);
1770 typename Traits::pointer p = reboundAlloc.allocate(1);
1772 Traits::construct(reboundAlloc,
1790 reboundAlloc.deallocate(p, 1);
1799#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 0
1800template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1>
1802typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1806 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1808 typename Traits::allocator_type reboundAlloc(allocator);
1809 typename Traits::pointer p = reboundAlloc.allocate(1);
1811 Traits::construct(reboundAlloc,
1816 reboundAlloc.deallocate(p, 1);
1823#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 1
1824template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01>
1826typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1831 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1833 typename Traits::allocator_type reboundAlloc(allocator);
1834 typename Traits::pointer p = reboundAlloc.allocate(1);
1836 Traits::construct(reboundAlloc,
1842 reboundAlloc.deallocate(p, 1);
1849#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 2
1850template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1853typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1859 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1861 typename Traits::allocator_type reboundAlloc(allocator);
1862 typename Traits::pointer p = reboundAlloc.allocate(1);
1864 Traits::construct(reboundAlloc,
1871 reboundAlloc.deallocate(p, 1);
1878#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 3
1879template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1883typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1890 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1892 typename Traits::allocator_type reboundAlloc(allocator);
1893 typename Traits::pointer p = reboundAlloc.allocate(1);
1895 Traits::construct(reboundAlloc,
1903 reboundAlloc.deallocate(p, 1);
1910#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 4
1911template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1916typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1924 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1926 typename Traits::allocator_type reboundAlloc(allocator);
1927 typename Traits::pointer p = reboundAlloc.allocate(1);
1929 Traits::construct(reboundAlloc,
1938 reboundAlloc.deallocate(p, 1);
1945#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 5
1946template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1952typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
1961 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
1963 typename Traits::allocator_type reboundAlloc(allocator);
1964 typename Traits::pointer p = reboundAlloc.allocate(1);
1966 Traits::construct(reboundAlloc,
1976 reboundAlloc.deallocate(p, 1);
1983#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 6
1984template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
1991typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
2001 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
2003 typename Traits::allocator_type reboundAlloc(allocator);
2004 typename Traits::pointer p = reboundAlloc.allocate(1);
2006 Traits::construct(reboundAlloc,
2017 reboundAlloc.deallocate(p, 1);
2024#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 7
2025template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
2033typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
2044 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
2046 typename Traits::allocator_type reboundAlloc(allocator);
2047 typename Traits::pointer p = reboundAlloc.allocate(1);
2049 Traits::construct(reboundAlloc,
2061 reboundAlloc.deallocate(p, 1);
2068#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 8
2069template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
2078typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
2090 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
2092 typename Traits::allocator_type reboundAlloc(allocator);
2093 typename Traits::pointer p = reboundAlloc.allocate(1);
2095 Traits::construct(reboundAlloc,
2108 reboundAlloc.deallocate(p, 1);
2115#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 9
2116template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
2126typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
2139 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
2141 typename Traits::allocator_type reboundAlloc(allocator);
2142 typename Traits::pointer p = reboundAlloc.allocate(1);
2144 Traits::construct(reboundAlloc,
2158 reboundAlloc.deallocate(p, 1);
2165#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 10
2166template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
2177typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
2191 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
2193 typename Traits::allocator_type reboundAlloc(allocator);
2194 typename Traits::pointer p = reboundAlloc.allocate(1);
2196 Traits::construct(reboundAlloc,
2211 reboundAlloc.deallocate(p, 1);
2218#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 11
2219template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
2231typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
2246 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
2248 typename Traits::allocator_type reboundAlloc(allocator);
2249 typename Traits::pointer p = reboundAlloc.allocate(1);
2251 Traits::construct(reboundAlloc,
2267 reboundAlloc.deallocate(p, 1);
2274#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 12
2275template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
2288typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
2304 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
2306 typename Traits::allocator_type reboundAlloc(allocator);
2307 typename Traits::pointer p = reboundAlloc.allocate(1);
2309 Traits::construct(reboundAlloc,
2326 reboundAlloc.deallocate(p, 1);
2333#if BSLMA_ALLOCATORUTIL_VARIADIC_LIMIT_B >= 13
2334template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class t_ARGS_01,
2348typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
2365 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
2367 typename Traits::allocator_type reboundAlloc(allocator);
2368 typename Traits::pointer p = reboundAlloc.allocate(1);
2370 Traits::construct(reboundAlloc,
2388 reboundAlloc.deallocate(p, 1);
2398# ifndef BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES
2399template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class... t_ARGS>
2401typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
2406 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
2408 typename Traits::allocator_type reboundAlloc(allocator);
2409 typename Traits::pointer p = reboundAlloc.allocate(1);
2411 Traits::construct(reboundAlloc,
2417 reboundAlloc.deallocate(p, 1);
2424template <
class t_TYPE,
class t_ALLOCATOR,
class t_ARG1,
class... t_ARGS>
2426typename AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
2431 typedef AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE> Traits;
2433 typename Traits::allocator_type reboundAlloc(allocator);
2434 typename Traits::pointer p = reboundAlloc.allocate(1);
2436 Traits::construct(reboundAlloc,
2442 reboundAlloc.deallocate(p, 1);
2450template <
class t_TYPE>
2458template <
class t_TYPE>
2470# error Not valid except when included from bslma_allocatorutil.h
Definition bslma_bslallocator.h:588
BloombergLP::bslma::Allocator * mechanism() const
Definition bslma_bslallocator.h:1146
Definition bslma_memoryresource.h:443
BSLA_NODISCARD void * allocate(size_t bytes, size_t alignment=k_MAX_ALIGN)
Definition bslma_memoryresource.h:550
void deallocate(void *p, size_t bytes, size_t alignment=k_MAX_ALIGN)
Definition bslma_memoryresource.h:556
Definition bslma_polymorphicallocator.h:460
memory_resource * resource() const
Return the address of the memory resource supplied on construction.
Definition bslma_polymorphicallocator.h:1074
Definition bslma_allocator.h:545
#define BSLMF_ASSERT(expr)
Definition bslmf_assert.h:231
static const bool value
Definition bslmf_integralconstant.h:267
#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_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:296
ALLOCATOR const STRING_VIEW_LIKE_TYPE & rhs
Definition bslstl_string.h:3918
ALLOCATOR & lhs
Definition bslstl_string.h:3917
Definition baljsn_encoder_testtypes.h:76
Definition bslma_allocatortraits.h:1089
Definition bslmf_conditional.h:123
Definition bslmf_enableif.h:530
Definition bslmf_integralconstant.h:261
Definition bslmf_isconst.h:145
Definition bslmf_isconvertible.h:875
Definition bslmf_issame.h:146
Definition bslmf_isvolatile.h:145
static bsl::enable_if<!IsDerivedFromBslAllocator< t_ALLOC >::value, t_ALLOC >::type adapt(const t_ALLOC &from)
Definition bslma_allocatorutil.h:871
static AllocatorUtil_Traits< t_ALLOCATOR, t_TYPE >::pointer newObject(const t_ALLOCATOR &allocator)
Definition bslma_allocatorutil.h:968
static AllocatorUtil_Traits< t_ALLOCATOR, t_TYPE >::pointer allocateObject(const t_ALLOCATOR &allocator, std::size_t n=1)
Definition bslma_allocatorutil.h:904
static void swap(t_TYPE *pa, t_TYPE *pb, bsl::false_type allowed)
Definition bslma_allocatorutil.h:1047
static AllocatorUtil_Traits< t_ALLOCATOR >::void_pointer allocateBytes(const t_ALLOCATOR &allocator, std::size_t nbytes, std::size_t alignment=0)
Definition bslma_allocatorutil.h:886
static void deleteObject(const t_ALLOCATOR &allocator, t_POINTER p)
Definition bslma_allocatorutil.h:959
static t_TYPE & assign(t_TYPE *lhs, const t_TYPE &rhs, bsl::true_type allowed)
Definition bslma_allocatorutil.h:922
static void deallocateObject(const t_ALLOCATOR &allocator, t_POINTER p, std::size_t n=1)
Definition bslma_allocatorutil.h:949
static void deallocateBytes(const t_ALLOCATOR &allocator, typename AllocatorUtil_Traits< t_ALLOCATOR >::void_pointer p, std::size_t nbytes, std::size_t alignment=0)
Definition bslma_allocatorutil.h:930
AlignmentImpPriorityToType< PRIORITY >::Type Type
Definition bsls_alignmenttotype.h:396
@ BSLS_MAX_ALIGNMENT
Definition bsls_alignmentutil.h:300
static int calculateAlignmentFromSize(std::size_t size)
Definition bsls_alignmentutil.h:398