BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bslma_allocatortraits_cpp03.h
Go to the documentation of this file.
1/// @file bslma_allocatortraits_cpp03.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bslma_allocatortraits_cpp03.h -*-C++-*-
8
9// Automatically generated file. **DO NOT EDIT**
10
11#ifndef INCLUDED_BSLMA_ALLOCATORTRAITS_CPP03
12#define INCLUDED_BSLMA_ALLOCATORTRAITS_CPP03
13
14/// @defgroup bslma_allocatortraits_cpp03 bslma_allocatortraits_cpp03
15/// @brief Provide C++03 implementation for bslma_allocatortraits.h
16/// @addtogroup bsl
17/// @{
18/// @addtogroup bslma
19/// @{
20/// @addtogroup bslma_allocatortraits_cpp03
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bslma_allocatortraits_cpp03-purpose"> Purpose</a>
25/// * <a href="#bslma_allocatortraits_cpp03-classes"> Classes </a>
26/// * <a href="#bslma_allocatortraits_cpp03-description"> Description </a>
27///
28/// # Purpose {#bslma_allocatortraits_cpp03-purpose}
29/// Provide C++03 implementation for bslma_allocatortraits.h
30///
31/// # Classes {#bslma_allocatortraits_cpp03-classes}
32/// See bslma_allocatortraits.h for list of classes
33///
34/// @see bslma_allocatortraits
35///
36/// # Description {#bslma_allocatortraits_cpp03-description}
37/// This component is the C++03 translation of a C++11 component,
38/// generated by the 'sim_cpp11_features.pl' program. If the original header
39/// contains any specially delimited regions of C++11 code, then this generated
40/// file contains the C++03 equivalent, i.e., with variadic templates expanded
41/// and rvalue-references replaced by 'bslmf::MovableRef' objects. The header
42/// code in this file is designed to be '#include'd into the original header
43/// when compiling with a C++03 compiler. If there are no specially delimited
44/// regions of C++11 code, then this header contains no code and is not
45/// '#include'd in the original header.
46///
47/// Generated on Mon Apr 28 19:19:39 2025
48/// Command line: sim_cpp11_features.pl bslma_allocatortraits.h
49/// @}
50/** @} */
51/** @} */
52
53/** @addtogroup bsl
54 * @{
55 */
56/** @addtogroup bslma
57 * @{
58 */
59/** @addtogroup bslma_allocatortraits_cpp03
60 * @{
61 */
62
63#ifdef COMPILING_BSLMA_ALLOCATORTRAITS_H
64
65#include <limits>
66
67
68namespace bslma {
69
70
71 // ================================
72 // AllocatorTraits_HasIsAlwaysEqual
73 // ================================
74
75/// This `struct` template provides a mechanism for determining whether a
76/// given (template parameter) `ALLOCATOR_TYPE` defines a nested alias named
77///`is_always_equal`. The static boolean member `value` (nested alias
78/// named `type`) is `true` (`bsl::true_type`) if `ALLOCATOR_TYPE` defines
79/// such an alias, and `false` (`bsl::false_type`) otherwise.
80///
81/// See @ref bslma_allocatortraits_cpp03
82template <class ALLOC>
83struct AllocatorTraits_HasIsAlwaysEqual {
84
85 private:
86 // PRIVATE TYPES
87 typedef struct { char d_a; } yes_type;
88 typedef struct { char d_a[2]; } no_type;
89
90 // PRIVATE CLASS METHODS
91
92 /// Return @ref yes_type if the (template parameter) `TYPE` defines a
93 /// nested alias named `is_always_equal`, and `no_type` otherwise.
94 template <class U>
95 static yes_type match(typename U::is_always_equal *);
96 template <class U>
97 static no_type match(...);
98
99 public:
100 // PUBLIC CLASS DATA
101 static const bool value = sizeof(match<ALLOC>(0)) == sizeof(yes_type);
102
103 // PUBLIC TYPES
105};
106
107 // =============================
108 // AllocatorTraits_IsAlwaysEqual
109 // =============================
110
111/// This `struct` template sets the boolean type for the attribute named
112/// `is_always_equal` to the nested type alias in the given (template
113/// parameter) `ALLOC` if `ALLOC` defines such an alias (i.e., if
114/// `true == AllocatorTraits_HasIsAlwaysEqual<ALLOCATOR_TYPE>::value`).
115template <class ALLOC, bool = AllocatorTraits_HasIsAlwaysEqual<ALLOC>::value>
116struct AllocatorTraits_IsAlwaysEqual : public ALLOC::is_always_equal
117{
118};
119
120/// This `struct` template sets the boolean type for the attribute named
121/// `is_always_equal` to `bsl::is_empty<ALLOC>` if the given (template
122/// parameter) `ALLOC` does not define such an alias (i.e., if
123/// `false == AllocatorTraits_HasIsAlwaysEqual<ALLOCATOR_TYPE>::value`).
124template <class ALLOC>
125struct AllocatorTraits_IsAlwaysEqual<ALLOC, false>
126 : public bsl::is_empty<ALLOC>
127{
128};
129
130 // =====================================
131 // AllocatorTraits_HasSelectOnCopyMethod
132 // =====================================
133
134/// This `struct` template provides a mechanism for determining whether a
135/// given (template parameter) `ALLOCATOR_TYPE` defines a `const` member
136/// function named @ref select_on_container_copy_construction that takes no
137/// arguments and returns an `ALLOCATOR_TYPE` object by value. The static
138/// boolean `value` (nested `type` alias) is `true` (`bsl::true_type`) if
139/// `ALLOCATOR_TYPE` defines such a method, and `false` (`bsl::false_type`)
140/// otherwise.
141///
142/// See @ref bslma_allocatortraits_cpp03
143template <class ALLOCATOR_TYPE>
144struct AllocatorTraits_HasSelectOnCopyMethod {
145
146 private:
147 typedef struct { char a; } yes_type;
148 typedef struct { char a[2]; } no_type;
149
150 /// This `struct` template provides a mechanism to check if a type
151 /// matches an instance within a SFINAE context.
152 ///
153 /// See @ref bslma_allocatortraits_cpp03
154 template <class T, T> struct MatchType { };
155
156 template <class T>
157 struct MethodAlias { typedef T (T::*Method)() const; };
158
159 /// Return @ref yes_type if the (template parameter) `TYPE` defines a const
160 /// member function named @ref select_on_container_copy_construction taking
161 /// no arguments and returning a `TYPE` object by value, and `no_type`
162 /// otherwise.
163 template <class TYPE>
164 static yes_type match(MatchType<typename MethodAlias<TYPE>::Method,
165 &TYPE::select_on_container_copy_construction> *);
166 template <class TYPE>
167 static no_type match(...);
168
169 public:
170 static const bool value =
171 sizeof(match<ALLOCATOR_TYPE>(0)) == sizeof(yes_type);
173};
174
175 // ===================================
176 // AllocatorTraits_HasPropOnCopyAssign
177 // ===================================
178
179/// This `struct` template provides a mechanism for determining whether a
180/// given (template parameter) `ALLOCATOR_TYPE` defines a nested alias named
181///@ref propagate_on_container_copy_assignment . The static boolean member
182/// `value` (nested alias named `type`) is `true` (`bsl::true_type`) if
183/// `ALLOCATOR_TYPE` defines such an alias, and `false` (`bsl::false_type`)
184/// otherwise.
185///
186/// See @ref bslma_allocatortraits_cpp03
187template <class ALLOCATOR_TYPE>
188struct AllocatorTraits_HasPropOnCopyAssign {
189
190 private:
191 typedef struct { char a; } yes_type;
192 typedef struct { char a[2]; } no_type;
193
194 /// Return @ref yes_type if the (template parameter) `TYPE` defines a
195 /// nested alias named @ref propagate_on_container_copy_assignment , and
196 /// `no_type` otherwise.
197 template <class U>
198 static
199 yes_type match(typename U::propagate_on_container_copy_assignment *);
200 template <class U>
201 static no_type match(...);
202
203 public:
204 static const bool value =
205 sizeof(match<ALLOCATOR_TYPE>(0)) == sizeof(yes_type);
207};
208
209 // ================================
210 // AllocatorTraits_PropOnCopyAssign
211 // ================================
212
213/// This `struct` template sets the boolean type for the attribute named
214/// @ref propagate_on_container_copy_assignment to `bsl::false_type` if the
215/// given (template parameter) `ALLOCATOR_TYPE` does not define such an
216/// alias (i.e.,
217/// `false == AllocatorTraits_HasPropOnCopyAssign<ALLOCATOR_TYPE>::value`).
218template <class ALLOCATOR_TYPE,
220struct AllocatorTraits_PropOnCopyAssign : bsl::false_type
221{
222};
223
224/// This `struct` template sets the boolean type for the attribute named
225/// @ref propagate_on_container_copy_assignment to the nested type alias in the
226/// given (template parameter) `ALLOCATOR_TYPE` if `ALLOCATOR_TYPE` defines
227/// such an alias (i.e.,
228/// `true == AllocatorTraits_HasPropOnCopyAssign<ALLOCATOR_TYPE>::value`).
229template <class ALLOC>
230struct AllocatorTraits_PropOnCopyAssign<ALLOC, true>
231 : public ALLOC::propagate_on_container_copy_assignment
232{
233};
234
235 // ===================================
236 // AllocatorTraits_HasPropOnMoveAssign
237 // ===================================
238
239/// This `struct` template provides a mechanism for determining whether a
240/// given (template parameter) `ALLOCATOR_TYPE` defines a nested alias named
241///@ref propagate_on_container_move_assignment . The static boolean member
242/// `value` (nested alias named `type`) is `true` (`bsl::true_type`) if
243/// `ALLOCATOR_TYPE` defines such an alias, and `false` (`bsl::false_type`)
244/// otherwise.
245///
246/// See @ref bslma_allocatortraits_cpp03
247template <class ALLOC>
248struct AllocatorTraits_HasPropOnMoveAssign {
249
250 private:
251 typedef struct { char a; } yes_type;
252 typedef struct { char a[2]; } no_type;
253
254 /// Return @ref yes_type if the (template parameter) `TYPE` defines a
255 /// nested alias named @ref propagate_on_container_move_assignment , and
256 /// `no_type` otherwise.
257 template <class U>
258 static
259 yes_type match(typename U::propagate_on_container_move_assignment *);
260 template <class U>
261 static no_type match(...);
262
263 public:
264 static const bool value = sizeof(match<ALLOC>(0)) == sizeof(yes_type);
266};
267
268 // ================================
269 // AllocatorTraits_PropOnMoveAssign
270 // ================================
271
272/// This `struct` template sets the boolean type for the attribute named
273/// @ref propagate_on_container_move_assignment to `bsl::false_type` if the
274/// given (template parameter) `ALLOCATOR_TYPE` does not define such an
275/// alias (i.e.,
276/// `false == AllocatorTraits_HasPropOnMoveAssign<ALLOCATOR_TYPE>::value`).
277template <class ALLOC,
279struct AllocatorTraits_PropOnMoveAssign : bsl::false_type
280{
281};
282
283/// This `struct` template sets the boolean type for the attribute named
284/// @ref propagate_on_container_move_assignment to the nested type alias in the
285/// given (template parameter) `ALLOCATOR_TYPE` if `ALLOCATOR_TYPE` defines
286/// such an alias (i.e.,
287/// `true == AllocatorTraits_HasPropOnMoveAssign<ALLOCATOR_TYPE>::value`).
288template <class ALLOC>
289struct AllocatorTraits_PropOnMoveAssign<ALLOC, true>
290 : public ALLOC::propagate_on_container_move_assignment
291{
292};
293
294 // =============================
295 // AllocatorTraits_HasPropOnSwap
296 // =============================
297
298/// This `struct` template provides a mechanism for determining whether a
299/// given (template parameter) `ALLOCATOR_TYPE` defines a nested alias named
300///@ref propagate_on_container_swap . The static boolean member `value` (nested
301/// alias named `type`) is `true` (`bsl::true_type`) if `ALLOCATOR_TYPE`
302/// defines such an alias, and `false` (`bsl::false_type`) otherwise.
303///
304/// See @ref bslma_allocatortraits_cpp03
305template <class ALLOC>
306struct AllocatorTraits_HasPropOnSwap {
307
308 private:
309 typedef struct { char a; } yes_type;
310 typedef struct { char a[2]; } no_type;
311
312 /// Return @ref yes_type if the (template parameter) `TYPE` defines a
313 /// nested alias named @ref propagate_on_container_swap , and `no_type`
314 /// otherwise.
315 template <class U>
316 static
317 yes_type match(typename U::propagate_on_container_swap *);
318 template <class U>
319 static no_type match(...);
320
321 public:
322 static const bool value = sizeof(match<ALLOC>(0)) == sizeof(yes_type);
324};
325
326 // ==========================
327 // AllocatorTraits_PropOnSwap
328 // ==========================
329
330/// This `struct` template sets the boolean type for the attribute named
331/// @ref propagate_on_container_swap to `bsl::false_type` if the given
332/// (template parameter) `ALLOCATOR_TYPE` does not define such an alias
333/// (i.e., `false == AllocatorTraits_HasPropOnSwap<ALLOCATOR_TYPE>::value`).
334template <class ALLOC, bool = AllocatorTraits_HasPropOnSwap<ALLOC>::value>
335struct AllocatorTraits_PropOnSwap : bsl::false_type
336{
337};
338
339/// This `struct` template sets the boolean type for the attribute named
340/// @ref propagate_on_container_swap to the nested type alias in the given
341/// (template parameter) `ALLOCATOR_TYPE` if `ALLOCATOR_TYPE` defines such
342/// an alias (i.e.,
343/// `false == AllocatorTraits_HasPropOnSwap<ALLOCATOR_TYPE>::value`).
344template <class ALLOC>
345struct AllocatorTraits_PropOnSwap<ALLOC, true>
346 : public ALLOC::propagate_on_container_swap
347{
348};
349
350#if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE) && \
351 defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) && \
352 defined(BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES)
353
354 // ==================================
355 // AllocatorTraits_HasConstructMethod
356 // ==================================
357
358template <class T, class Return, class... Args>
359struct AllocatorTraits_HasConstructMethod {
360 private:
361 template <class U>
362 static auto match(U *) ->
364 bslmf::Util::declval<Args>()...)),
365 Return>::type;
366 template <class>
367 static bsl::false_type match(...);
368
369 public:
370 typedef decltype(match<T>(0)) type;
371 static const bool value = type::value;
372};
373
374 // ================================
375 // AllocatorTraits_HasDestroyMethod
376 // ================================
377
378template <class T, class Return, class... Args>
379struct AllocatorTraits_HasDestroyMethod {
380 private:
381 template <class U>
382 static auto match(U *) ->
384 bslmf::Util::declval<Args>()...)),
385 Return>::type;
386 template <class>
387 static bsl::false_type match(...);
388
389 public:
390 typedef decltype(match<T>(0)) type;
391 static const bool value = type::value;
392};
393
394#endif
395
396 // ===========================
397 // AllocatorTraits_PointerType
398 // ===========================
399
400template <class T, class = void>
401struct AllocatorTraits_PointerType {
402 typedef typename T::value_type *type;
403};
404
405
406template <class T>
407struct AllocatorTraits_PointerType<T, BSLMF_VOIDTYPE(typename T::pointer)> {
408 typedef typename T::pointer type;
409};
410
411 // ================================
412 // AllocatorTraits_ConstPointerType
413 // ================================
414
415template <class T, class = void>
416struct AllocatorTraits_ConstPointerType {
417 /// should be pointer_traits::rebind of template above
418 typedef const typename T::value_type *type;
419};
420
421
422template <class T>
423struct AllocatorTraits_ConstPointerType<
424 T,
425 BSLMF_VOIDTYPE(typename T::const_pointer)> {
426 typedef typename T::const_pointer type;
427};
428
429
430 // ===============================
431 // AllocatorTraits_VoidPointerType
432 // ===============================
433
434template <class T, class = void>
435struct AllocatorTraits_VoidPointerType {
436 /// should be pointer_traits::rebind of template above
437 typedef void *type;
438};
439
440
441template <class T>
442struct AllocatorTraits_VoidPointerType<
443 T,
444 BSLMF_VOIDTYPE(typename T::void_pointer)> {
445 typedef typename T::void_pointer type;
446};
447
448 // ====================================
449 // AllocatorTraits_ConstVoidPointerType
450 // ====================================
451
452template <class T, class = void>
453struct AllocatorTraits_ConstVoidPointerType {
454 /// should be pointer_traits::rebind of template above
455 typedef const void *type;
456};
457
458
459template <class T>
460struct AllocatorTraits_ConstVoidPointerType<
461 T,
462 BSLMF_VOIDTYPE(typename T::const_void_pointer)> {
463 typedef typename T::const_void_pointer type;
464};
465
466 // ========================
467 // AllocatorTraits_SizeType
468 // ========================
469
470template <class T, class = void>
471struct AllocatorTraits_SizeType {
472 typedef std::size_t type;
473};
474
475
476template <class T>
477struct AllocatorTraits_SizeType<T, BSLMF_VOIDTYPE(typename T::size_type)> {
478 typedef typename T::size_type type;
479};
480
481 // ==============================
482 // AllocatorTraits_DifferenceType
483 // ==============================
484
485/// should be pointer_traits::rebind of template above
486///
487/// See @ref bslma_allocatortraits_cpp03
488template <class T, class = void>
489struct AllocatorTraits_DifferenceType {
490 typedef std::ptrdiff_t type;
491
492};
493
494
495template <class T>
496struct AllocatorTraits_DifferenceType<
497 T,
498 BSLMF_VOIDTYPE(typename T::difference_type)> {
499 typedef typename T::difference_type type;
500};
501
502 // ===========================
503 // AllocatorTraits_RebindFront
504 // ===========================
505
506#if defined(BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES)
507/// There shall be no member named `type` unless T is a class template with
508/// only type parameters.
509///
510/// See @ref bslma_allocatortraits_cpp03
511template <class T, class U>
512struct AllocatorTraits_RebindFront {
513};
514
515template <template <class, class...> class ALLOC,
516 class T,
517 class ...ARGS,
518 class U>
519struct AllocatorTraits_RebindFront<ALLOC<T, ARGS...>, U> {
520 using type = ALLOC<U, ARGS...>;
521};
522#else
523template <class T, class U>
524struct AllocatorTraits_RebindFront {
525 // There shall be no member named 'type' unless T is a class template with
526 // only type parameters.
527};
528
529template <template <class> class ALLOC,
530 class T,
531 class U>
532struct AllocatorTraits_RebindFront<ALLOC<T>, U> {
533 typedef ALLOC<U> type;
534};
535#endif
536
537 // ===========================
538 // AllocatorTraits_RebindAlloc
539 // ===========================
540
541/// should be pointer_traits::rebind of template above
542///
543/// See @ref bslma_allocatortraits_cpp03
544template <class T, class U, class = void>
545struct AllocatorTraits_RebindAlloc {
546 typedef typename AllocatorTraits_RebindFront<T, U>::type type;
547};
548
549template <class T, class U>
550struct AllocatorTraits_RebindAlloc<
551 T,
552 U,
553 BSLMF_VOIDTYPE(typename T::template rebind<U>::other)> {
554 typedef typename T::template rebind<U>::other type;
555};
556
557 // ===========================
558 // AllocatorTraits_CallMaxSize
559 // ===========================
560
561#if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE)
562template <class T, class = void>
563struct AllocatorTraits_CallMaxSize {
564
565 // PUBLIC TYPES
566 typedef typename AllocatorTraits_SizeType<T>::type SizeType;
567
568 // PUBLIC CLASS METHODS
569
570 /// Return the maximum size of the specified (template) parameter `T`.
571 /// Also note that this method is defined inline to work around a
572 /// Windows compiler bug with SFINAE functions.
573 static SizeType max_size(const T &)
574 {
575 return std::numeric_limits<SizeType>::max() /
576 sizeof(typename T::value_type);
577 }
578};
579
580// Due to the dependence on expression SFINAE to detect the presence of a
581// @ref max_size member of the allocator, this is only done on more modern
582// platforms.
583template <class T>
584struct AllocatorTraits_CallMaxSize<
585 T,
586 BSLMF_VOIDTYPE(decltype(bslmf::Util::declval<T>().max_size()))> {
587
588 // PUBLIC TYPES
589 typedef typename AllocatorTraits_SizeType<T>::type SizeType;
590
591 // PUBLIC CLASS METHODS
592
593 /// Return the maximum size of the specified `alloc`. Also note that
594 /// this method is defined inline to work around a Windows compiler bug
595 /// with SFINAE functions.
596 static SizeType max_size(const T &alloc)
597 {
598 return alloc.max_size();
599 }
600};
601#endif
602
603} // close namespace bslma
604
605
606namespace bsl {
607
608 // ======================
609 // class allocator_traits
610 // ======================
611
612/// This class supports the complete interface of the C++11
613/// `allocator_traits` class template, which provides a uniform mechanism
614/// for accessing nested types within, and operations on, any
615/// standard-conforming allocator. A specialization of this class template
616/// for `bsl::allocator` provides support for Bloomberg's `bslma` allocator
617/// model (see the @ref bslma_bslallocator component for more details). In
618/// C++11 compilation environments, the `construct` methods forward to the
619/// allocator's `construct` method if such a method matching the (variable
620/// number of) specified constructor arguments exists; otherwise, the
621/// `construct` method falls back to invoking the constructor of the element
622/// type directly. In C++03 compilation environments, there is no reliable
623/// way to detect if the type provide a method that matches a (variable
624/// number of) specified arguments; therefore, we require that standard
625/// allocator types define `construct` methods taking a variable number of
626/// arguments in those environments. This implementation is not
627/// fully-standard-conforming in that it does not support deduce data types
628/// that are not specified in the allocator.
629///
630/// See @ref bslma_allocatortraits_cpp03
631template <class ALLOCATOR_TYPE>
632struct allocator_traits {
633
634 private:
635
636 typedef typename BloombergLP::bslma::AllocatorTraits_HasSelectOnCopyMethod<
637 ALLOCATOR_TYPE>::type DelegateSelectMethod;
638
639 /// Return the result of invoking the
640 /// @ref select_on_container_copy_construction method on the specified
641 /// `stdAllocator`.
642 static
643 ALLOCATOR_TYPE selectOnCopyConstruct(const ALLOCATOR_TYPE& stdAllocator,
644 true_type);
645
646 /// Return the specified `stdAllocator`.
647 /// \note Note that this behavior
648 /// enforces a default policy of propagating the allocator on copy
649 /// construction when using a standard allocator.
650 static
651 ALLOCATOR_TYPE selectOnCopyConstruct(const ALLOCATOR_TYPE& stdAllocator,
652 false_type);
653
654#if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE) && \
655 defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) && \
656 defined(BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES)
657 /// Construct an object of (template parameter) type `ELEMENT_TYPE` at
658 /// the specified `elementAddr`, either by 1) calling the `construct`
659 /// method on `basicAllocator` with `elemAddr` and the specified
660 /// (variable number of) `arguments` if the (template parameter) type
661 /// `ALLOCATOR_TYPE` defines such a method, or 2) forwarding the
662 /// specified (variable number of) `arguments` to the constructor of
663 /// `ELEMENT_TYPE` directly (and ignoring `basicAllocator`) otherwise.
664 ///
665 /// \pre The behavior is undefined unless `elementAddr` refers to valid,
666 /// uninitialized storage.
667 template <class ELEMENT_TYPE, class... Args>
668 static typename bsl::enable_if<
669 BloombergLP::bslma::AllocatorTraits_HasConstructMethod<ALLOCATOR_TYPE,
670 void,
671 ELEMENT_TYPE *,
672 Args...>::value,
673 void>::type
674 privateConstruct(ALLOCATOR_TYPE& basicAllocator,
675 ELEMENT_TYPE *elementAddr,
676 Args&&... arguments);
677 template <class ELEMENT_TYPE, class... Args>
678 static typename bsl::enable_if<
679 !BloombergLP::bslma::AllocatorTraits_HasConstructMethod<
680 ALLOCATOR_TYPE,
681 void,
682 ELEMENT_TYPE *,
683 Args...>::value,
684 void>::type
685 privateConstruct(ALLOCATOR_TYPE& basicAllocator,
686 ELEMENT_TYPE *elementAddr,
687 Args&&... arguments);
688
689 template <class ELEMENT_TYPE>
690 static typename bsl::enable_if<
691 BloombergLP::bslma::AllocatorTraits_HasDestroyMethod<
692 ALLOCATOR_TYPE,
693 void,
694 ELEMENT_TYPE *>::value,
695 void>::type
696 privateDestroy(ALLOCATOR_TYPE& basicAllocator, ELEMENT_TYPE *elementAddr);
697
698 /// Destroy the object of (template parameter) type `ELEMENT_TYPE` at
699 /// the specified `elementAddr`, either by 1) calling the `destroy`
700 /// method on `basicAllocator` with `elemAddr` as the sole argument if
701 /// the (template parameter) type `ALLOCATOR_TYPE` defines such a
702 /// method, or 2) calling the destructor directly on `elementAddr` (and
703 /// ignoring `basicAllocator`) otherwise.
704 ///
705 /// \pre The behavior is undefined unless `elementAddr` refers to a valid, constructed object.
706 template <class ELEMENT_TYPE>
707 static typename bsl::enable_if<
708 !BloombergLP::bslma::AllocatorTraits_HasDestroyMethod<
709 ALLOCATOR_TYPE,
710 void,
711 ELEMENT_TYPE *>::value,
712 void>::type
713 privateDestroy(ALLOCATOR_TYPE& basicAllocator, ELEMENT_TYPE *elementAddr);
714#endif
715
716 public:
717 // PUBLIC TYPES
718 typedef ALLOCATOR_TYPE allocator_type;
719 typedef typename ALLOCATOR_TYPE::value_type value_type;
720
721 typedef typename
722 BloombergLP::bslma::AllocatorTraits_PointerType<ALLOCATOR_TYPE>::type
723 pointer;
724 typedef typename
725 BloombergLP::bslma::AllocatorTraits_ConstPointerType<ALLOCATOR_TYPE>::type
727 typedef typename
728 BloombergLP::bslma::AllocatorTraits_VoidPointerType<ALLOCATOR_TYPE>::type
730 typedef typename BloombergLP::bslma::
731 AllocatorTraits_ConstVoidPointerType<ALLOCATOR_TYPE>::type
733
734 typedef typename
735 BloombergLP::bslma::AllocatorTraits_DifferenceType<ALLOCATOR_TYPE>::type
737 typedef typename
738 BloombergLP::bslma::AllocatorTraits_SizeType<ALLOCATOR_TYPE>::type
739 size_type;
740
741#ifdef BSLS_COMPILERFEATURES_SUPPORT_ALIAS_TEMPLATES
742 template <class ELEMENT_TYPE>
743 using rebind_alloc = typename
744 BloombergLP::bslma::AllocatorTraits_RebindAlloc<ALLOCATOR_TYPE,
745 ELEMENT_TYPE>::type;
746
747 template <class ELEMENT_TYPE>
748 using rebind_traits = allocator_traits<rebind_alloc<ELEMENT_TYPE>>;
749#else // !BSLS_COMPILERFEATURES_SUPPORT_ALIAS_TEMPLATES
750 template <class ELEMENT_TYPE>
751 struct rebind_alloc
752 : BloombergLP::bslma::AllocatorTraits_RebindAlloc<ALLOCATOR_TYPE,
753 ELEMENT_TYPE>::type
754 {
755 // Note that this class attempts to emulate an alias template, but is
756 // not complete. In general, code that must support C++03 should use
757 // 'rebind_traits<ELEMENT_TYPE>::allocator_type' instead of
758 // 'rebind_alloc<ELEMENT_TYPE>' because that nested typedef is the
759 // preferred actual allocator type and not a subclass of the desired
760 // type.
761
762 typedef typename BloombergLP::bslma::
763 AllocatorTraits_RebindAlloc<ALLOCATOR_TYPE, ELEMENT_TYPE>::type
765
766 template <typename ARG>
767 rebind_alloc(const ARG& allocatorArg)
768 // Convert from anything that can be used to construct the base
769 // type. This might be better if SFINAE-ed out using
770 // 'is_convertible', but stressing older compilers more seems
771 // unwise.
772 : allocator_type(allocatorArg)
773 {
774 }
775 };
776
777 template <class ELEMENT_TYPE>
778 struct rebind_traits : allocator_traits<typename allocator_traits::template
779 rebind_alloc<ELEMENT_TYPE>::allocator_type>
780 {
781 };
782#endif // !BSLS_COMPILERFEATURES_SUPPORT_ALIAS_TEMPLATES
783
784 // Allocation functions
785
786 /// Return `basicAllocator.allocate(n)`.
787 static pointer allocate(ALLOCATOR_TYPE& basicAllocator, size_type n);
788
789 /// Return `basicAllocator.allocate(n, hint)`.
790 static pointer allocate(ALLOCATOR_TYPE& basicAllocator,
791 size_type n,
792 const_void_pointer hint);
793
794 /// Invoke `basicAllocator.deallocate(elementAddr, n)`.
795 ///
796 /// \pre The behavior is undefined unless the specified `elementAddr` was returned from a
797 /// prior call to the `allocate` method of an allocator that compares
798 /// equal to the specified `allocator`, and has not yet been passed to a
799 /// `deallocate` call of such an allocator object.
800 static void deallocate(ALLOCATOR_TYPE& basicAllocator,
801 pointer elementAddr,
802 size_type n);
803
804 // Element creation functions
805
806#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
807// {{{ BEGIN GENERATED CODE
808// Command line: sim_cpp11_features.pl bslma_allocatortraits.h
809#ifndef BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT
810#define BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT 14
811#endif
812#ifndef BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A
813#define BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT
814#endif
815
816#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 0
817 template <class ELEMENT_TYPE>
818 static void construct(ALLOCATOR_TYPE& basicAllocator,
819 ELEMENT_TYPE *elementAddr);
820#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 0
821
822#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 1
823 template <class ELEMENT_TYPE, class Args_01>
824 static void construct(ALLOCATOR_TYPE& basicAllocator,
825 ELEMENT_TYPE *elementAddr,
826 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01);
827#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 1
828
829#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 2
830 template <class ELEMENT_TYPE, class Args_01,
831 class Args_02>
832 static void construct(ALLOCATOR_TYPE& basicAllocator,
833 ELEMENT_TYPE *elementAddr,
834 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
835 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02);
836#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 2
837
838#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 3
839 template <class ELEMENT_TYPE, class Args_01,
840 class Args_02,
841 class Args_03>
842 static void construct(ALLOCATOR_TYPE& basicAllocator,
843 ELEMENT_TYPE *elementAddr,
844 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
845 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
846 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03);
847#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 3
848
849#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 4
850 template <class ELEMENT_TYPE, class Args_01,
851 class Args_02,
852 class Args_03,
853 class Args_04>
854 static void construct(ALLOCATOR_TYPE& basicAllocator,
855 ELEMENT_TYPE *elementAddr,
856 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
857 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
858 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
859 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04);
860#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 4
861
862#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 5
863 template <class ELEMENT_TYPE, class Args_01,
864 class Args_02,
865 class Args_03,
866 class Args_04,
867 class Args_05>
868 static void construct(ALLOCATOR_TYPE& basicAllocator,
869 ELEMENT_TYPE *elementAddr,
870 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
871 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
872 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
873 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
874 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05);
875#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 5
876
877#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 6
878 template <class ELEMENT_TYPE, class Args_01,
879 class Args_02,
880 class Args_03,
881 class Args_04,
882 class Args_05,
883 class Args_06>
884 static void construct(ALLOCATOR_TYPE& basicAllocator,
885 ELEMENT_TYPE *elementAddr,
886 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
887 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
888 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
889 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
890 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
891 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06);
892#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 6
893
894#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 7
895 template <class ELEMENT_TYPE, class Args_01,
896 class Args_02,
897 class Args_03,
898 class Args_04,
899 class Args_05,
900 class Args_06,
901 class Args_07>
902 static void construct(ALLOCATOR_TYPE& basicAllocator,
903 ELEMENT_TYPE *elementAddr,
904 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
905 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
906 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
907 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
908 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
909 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
910 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07);
911#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 7
912
913#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 8
914 template <class ELEMENT_TYPE, class Args_01,
915 class Args_02,
916 class Args_03,
917 class Args_04,
918 class Args_05,
919 class Args_06,
920 class Args_07,
921 class Args_08>
922 static void construct(ALLOCATOR_TYPE& basicAllocator,
923 ELEMENT_TYPE *elementAddr,
924 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
925 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
926 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
927 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
928 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
929 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
930 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
931 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08);
932#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 8
933
934#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 9
935 template <class ELEMENT_TYPE, class Args_01,
936 class Args_02,
937 class Args_03,
938 class Args_04,
939 class Args_05,
940 class Args_06,
941 class Args_07,
942 class Args_08,
943 class Args_09>
944 static void construct(ALLOCATOR_TYPE& basicAllocator,
945 ELEMENT_TYPE *elementAddr,
946 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
947 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
948 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
949 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
950 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
951 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
952 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
953 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08,
954 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) arguments_09);
955#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 9
956
957#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 10
958 template <class ELEMENT_TYPE, class Args_01,
959 class Args_02,
960 class Args_03,
961 class Args_04,
962 class Args_05,
963 class Args_06,
964 class Args_07,
965 class Args_08,
966 class Args_09,
967 class Args_10>
968 static void construct(ALLOCATOR_TYPE& basicAllocator,
969 ELEMENT_TYPE *elementAddr,
970 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
971 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
972 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
973 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
974 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
975 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
976 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
977 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08,
978 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) arguments_09,
979 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) arguments_10);
980#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 10
981
982#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 11
983 template <class ELEMENT_TYPE, class Args_01,
984 class Args_02,
985 class Args_03,
986 class Args_04,
987 class Args_05,
988 class Args_06,
989 class Args_07,
990 class Args_08,
991 class Args_09,
992 class Args_10,
993 class Args_11>
994 static void construct(ALLOCATOR_TYPE& basicAllocator,
995 ELEMENT_TYPE *elementAddr,
996 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
997 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
998 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
999 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
1000 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
1001 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
1002 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
1003 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08,
1004 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) arguments_09,
1005 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) arguments_10,
1006 BSLS_COMPILERFEATURES_FORWARD_REF(Args_11) arguments_11);
1007#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 11
1008
1009#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 12
1010 template <class ELEMENT_TYPE, class Args_01,
1011 class Args_02,
1012 class Args_03,
1013 class Args_04,
1014 class Args_05,
1015 class Args_06,
1016 class Args_07,
1017 class Args_08,
1018 class Args_09,
1019 class Args_10,
1020 class Args_11,
1021 class Args_12>
1022 static void construct(ALLOCATOR_TYPE& basicAllocator,
1023 ELEMENT_TYPE *elementAddr,
1024 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
1025 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
1026 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
1027 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
1028 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
1029 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
1030 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
1031 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08,
1032 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) arguments_09,
1033 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) arguments_10,
1034 BSLS_COMPILERFEATURES_FORWARD_REF(Args_11) arguments_11,
1035 BSLS_COMPILERFEATURES_FORWARD_REF(Args_12) arguments_12);
1036#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 12
1037
1038#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 13
1039 template <class ELEMENT_TYPE, class Args_01,
1040 class Args_02,
1041 class Args_03,
1042 class Args_04,
1043 class Args_05,
1044 class Args_06,
1045 class Args_07,
1046 class Args_08,
1047 class Args_09,
1048 class Args_10,
1049 class Args_11,
1050 class Args_12,
1051 class Args_13>
1052 static void construct(ALLOCATOR_TYPE& basicAllocator,
1053 ELEMENT_TYPE *elementAddr,
1054 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
1055 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
1056 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
1057 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
1058 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
1059 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
1060 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
1061 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08,
1062 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) arguments_09,
1063 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) arguments_10,
1064 BSLS_COMPILERFEATURES_FORWARD_REF(Args_11) arguments_11,
1065 BSLS_COMPILERFEATURES_FORWARD_REF(Args_12) arguments_12,
1066 BSLS_COMPILERFEATURES_FORWARD_REF(Args_13) arguments_13);
1067#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 13
1068
1069#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 14
1070 template <class ELEMENT_TYPE, class Args_01,
1071 class Args_02,
1072 class Args_03,
1073 class Args_04,
1074 class Args_05,
1075 class Args_06,
1076 class Args_07,
1077 class Args_08,
1078 class Args_09,
1079 class Args_10,
1080 class Args_11,
1081 class Args_12,
1082 class Args_13,
1083 class Args_14>
1084 static void construct(ALLOCATOR_TYPE& basicAllocator,
1085 ELEMENT_TYPE *elementAddr,
1086 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
1087 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
1088 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
1089 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
1090 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
1091 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
1092 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
1093 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08,
1094 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) arguments_09,
1095 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) arguments_10,
1096 BSLS_COMPILERFEATURES_FORWARD_REF(Args_11) arguments_11,
1097 BSLS_COMPILERFEATURES_FORWARD_REF(Args_12) arguments_12,
1098 BSLS_COMPILERFEATURES_FORWARD_REF(Args_13) arguments_13,
1099 BSLS_COMPILERFEATURES_FORWARD_REF(Args_14) arguments_14);
1100#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_A >= 14
1101
1102#else
1103// The generated code below is a workaround for the absence of perfect
1104// forwarding in some compilers.
1105
1106 template <class ELEMENT_TYPE, class... Args>
1107 static void construct(ALLOCATOR_TYPE& basicAllocator,
1108 ELEMENT_TYPE *elementAddr,
1109 BSLS_COMPILERFEATURES_FORWARD_REF(Args)... arguments);
1110// }}} END GENERATED CODE
1111#endif
1112
1113 /// Destroy the object of (template parameter) type `ELEMENT_TYPE` at
1114 /// the specified `elementAddr`, either by 1) calling the `destroy`
1115 /// method on `basicAllocator` with `elemAddr` as the sole argument if
1116 /// the (template parameter) type `ALLOCATOR_TYPE` defines such a
1117 /// method, or 2) calling the destructor directly on `elementAddr` (and
1118 /// ignoring `basicAllocator`) otherwise.
1119 ///
1120 /// \pre The behavior is undefined unless `elementAddr` refers to a valid, constructed object.
1121 template <class ELEMENT_TYPE>
1122 static void destroy(ALLOCATOR_TYPE& basicAllocator,
1123 ELEMENT_TYPE *elementAddr);
1124
1125 /// Return the largest number of `value_type` objects that could
1126 /// reasonably be returned by a single invocation of `allocate` for the
1127 /// specified `allocator`, i.e., `allocator.max_size()`.
1128 static size_type max_size(const ALLOCATOR_TYPE& basicAllocator)
1130
1131 // Allocator propagation traits
1132
1133 /// Return a copy of the allocator that should be used to copy-
1134 /// construct one container from another container whose allocator is
1135 /// the specified `rhs`. If the parameterized `ALLOCATOR_TYPE` defines
1136 /// a method @ref select_on_container_copy_construction , this function
1137 /// returns the result of calling that method on `rhs`; otherwise, this
1138 /// method enforces the default policy of propagating the allocator on
1139 /// copy construction, as is standard practice for standard allocators (i.e., returns `rhs`).
1140 ///
1141 /// \note Note that the specialization of this class
1142 /// template for `bsl::allocator` (in the @ref bslma_bslallocator
1143 /// component) provides the alternate default behavior of *not*
1144 /// propagating the allocator on copy construction (i.e., returning a
1145 /// default-constructed allocator object).
1146 static ALLOCATOR_TYPE
1147 select_on_container_copy_construction(const ALLOCATOR_TYPE& rhs);
1148
1149 /// Identical to, or derived from `true_type` if two allocators of
1150 /// parameterized `ALLOCATOR_TYPE` always compare equal; otherwise
1151 /// identical to or derived from `false_type`. This type is
1152 /// `ALLOCATOR_TYPE::is_always_equal` if such a type is defined, and
1153 /// `is_empty<ALLOCATOR_TYPE>` otherwise.
1154 typedef typename BloombergLP::bslma::AllocatorTraits_IsAlwaysEqual<
1155 ALLOCATOR_TYPE>::type is_always_equal;
1156
1157 /// Identical to, or derived from `true_type` if an allocator of
1158 /// parameterized `ALLOCATOR_TYPE` should be copied when a container
1159 /// using that `ALLOCATOR_TYPE` is copy-assigned; otherwise identical to
1160 /// or derived from `false_type`. This type is
1161 /// `ALLOCATOR_TYPE::propagate_on_container_copy_assignment` if such a
1162 /// type is defined, and `false_type` otherwise.
1163 typedef typename BloombergLP::bslma::AllocatorTraits_PropOnCopyAssign<
1164 ALLOCATOR_TYPE>::type propagate_on_container_copy_assignment;
1165
1166 /// Identical to, or derived from `true_type` if an allocator of
1167 /// parameterized `ALLOCATOR_TYPE` should be moved when a container
1168 /// using that `ALLOCATOR_TYPE` is move-assigned; otherwise identical to
1169 /// or derived from `false_type`. This type is
1170 /// `ALLOCATOR_TYPE::propagate_on_container_move_assignment` if such a
1171 /// type is defined, and `false_type` otherwise.
1172 typedef typename BloombergLP::bslma::AllocatorTraits_PropOnMoveAssign<
1173 ALLOCATOR_TYPE>::type propagate_on_container_move_assignment;
1174
1175 /// Identical to, or derived from `true_type` if the allocators of
1176 /// parameterized `ALLOCATOR_TYPE` should be swapped when containers
1177 /// using that `ALLOCATOR_TYPE` are swapped; otherwise identical to or
1178 /// derived from `false_type`. This type is
1179 /// `ALLOCATOR_TYPE::propagate_on_container_swap` if such a type is
1180 /// defined, and `false_type` otherwise.
1181 typedef typename BloombergLP::bslma::AllocatorTraits_PropOnSwap<
1182 ALLOCATOR_TYPE>::type propagate_on_container_swap;
1183};
1184
1185 // ========================================
1186 // class allocator_traits<ALLOCATOR_TYPE *>
1187 // ========================================
1188
1189/// TBD: improve comment This is an empty class specialization of
1190/// `allocator_traits` for pointer types that (intentionally) does not
1191/// define any of the traits typedefs. It's needed in order make
1192/// unambiguous function overloads that take both a standard allocator by
1193/// value and a `bslma::Allocator *`. By using the typedefs defined in
1194/// `allocator_traits` in the signature of functions taking standard
1195/// allocators, we can ensure that those overloads are not considered when
1196/// using `bslma`-style allocators.
1197template <class ALLOCATOR_TYPE>
1198struct allocator_traits<ALLOCATOR_TYPE *> {
1199};
1200
1201#if BSLS_COMPILERFEATURES_CPLUSPLUS >= 201703L
1202// Since C++17 many of the `std::allocator` members are deprecated (and removed
1203// in C++20). C++23 deprecates type name members and C++26 removes them. The
1204// clang compiler on Darwin warns about any mention of those names in C++17 so
1205// this header file was producing many warnings. The specialization below
1206// "disconnects" the allocator traits of `std::allocator` from our own
1207// implementation and so it avoids not only warnings but possible other hassles
1208// as the `std::allocator` interface is morphing.
1209//
1210// Note that we are using the standard traits (in place of ours) only on C++17
1211// or later compilers and not C++11 (when `std::allocator_traits` appeared).
1212// The reason for this is that our `bsl::allocator_traits` supports
1213// `allocator_traits::is_always_equal` from C++17 in a backwards compatible
1214// manner so we cannot use pre-C++17 standard implementation that does not have
1215// that.
1216template <class ALLOCATOR_TYPE>
1217struct allocator_traits<std::allocator<ALLOCATOR_TYPE> >
1218: std::allocator_traits<std::allocator<ALLOCATOR_TYPE> > {
1219};
1220
1221#endif
1222
1223} // close namespace bsl
1224
1225// ============================================================================
1226// INLINE AND TEMPLATE STATIC MEMBER FUNCTION DEFINITIONS
1227// ============================================================================
1228
1229namespace bsl {
1230
1231 // ----------------------
1232 // class allocator_traits
1233 // ----------------------
1234
1235template <class ALLOCATOR_TYPE>
1236inline
1237ALLOCATOR_TYPE allocator_traits<ALLOCATOR_TYPE>::selectOnCopyConstruct(
1238 const ALLOCATOR_TYPE& stdAllocator,
1239 true_type)
1240{
1241 return stdAllocator.select_on_container_copy_construction();
1242}
1243
1244template <class ALLOCATOR_TYPE>
1245inline
1246ALLOCATOR_TYPE allocator_traits<ALLOCATOR_TYPE>::selectOnCopyConstruct(
1247 const ALLOCATOR_TYPE& stdAllocator,
1248 false_type)
1249{
1250 return stdAllocator;
1251}
1252
1253#if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE) && \
1254 defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) && \
1255 defined(BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES)
1256template <class ALLOCATOR_TYPE>
1257template <class ELEMENT_TYPE, class... Args>
1258inline
1259typename bsl::enable_if<
1260 BloombergLP::bslma::AllocatorTraits_HasConstructMethod<ALLOCATOR_TYPE,
1261 void,
1262 ELEMENT_TYPE *,
1263 Args...>::value,
1264 void>::type
1265allocator_traits<ALLOCATOR_TYPE>::privateConstruct(
1266 ALLOCATOR_TYPE& basicAllocator,
1267 ELEMENT_TYPE *elementAddr,
1268 Args&&... arguments)
1269{
1270 basicAllocator.construct(
1271 elementAddr, BSLS_COMPILERFEATURES_FORWARD(Args, arguments)...);
1272}
1273
1274template <class ALLOCATOR_TYPE>
1275template <class ELEMENT_TYPE, class... Args>
1276inline
1277typename bsl::enable_if<
1278 !BloombergLP::bslma::AllocatorTraits_HasConstructMethod<ALLOCATOR_TYPE,
1279 void,
1280 ELEMENT_TYPE *,
1281 Args...>::value,
1282 void>::type
1283allocator_traits<ALLOCATOR_TYPE>::privateConstruct(ALLOCATOR_TYPE&,
1284 ELEMENT_TYPE *elementAddr,
1285 Args&&... arguments)
1286{
1287 ::new (static_cast<void *>(elementAddr))
1288 ELEMENT_TYPE(BSLS_COMPILERFEATURES_FORWARD(Args, arguments)...);
1289}
1290
1291template <class ALLOCATOR_TYPE>
1292template <class ELEMENT_TYPE>
1293inline
1294typename bsl::enable_if<BloombergLP::bslma::AllocatorTraits_HasDestroyMethod<
1295 ALLOCATOR_TYPE,
1296 void,
1297 ELEMENT_TYPE *>::value,
1298 void>::type
1299allocator_traits<ALLOCATOR_TYPE>::privateDestroy(
1300 ALLOCATOR_TYPE& basicAllocator,
1301 ELEMENT_TYPE *elementAddr)
1302{
1303 basicAllocator.destroy(elementAddr);
1304}
1305
1306template <class ALLOCATOR_TYPE>
1307template <class ELEMENT_TYPE>
1308inline
1309typename bsl::enable_if<!BloombergLP::bslma::AllocatorTraits_HasDestroyMethod<
1310 ALLOCATOR_TYPE,
1311 void,
1312 ELEMENT_TYPE *>::value,
1313 void>::type
1314allocator_traits<ALLOCATOR_TYPE>::privateDestroy(ALLOCATOR_TYPE&,
1315 ELEMENT_TYPE *elementAddr)
1316{
1317 elementAddr->~ELEMENT_TYPE();
1318}
1319#endif
1320
1321// Allocation functions
1322
1323template <class ALLOCATOR_TYPE>
1324inline
1326allocator_traits<ALLOCATOR_TYPE>::allocate(ALLOCATOR_TYPE& basicAllocator,
1327 size_type n)
1328{
1329 return basicAllocator.allocate(n);
1330}
1331
1332template <class ALLOCATOR_TYPE>
1333inline
1335allocator_traits<ALLOCATOR_TYPE>::allocate(ALLOCATOR_TYPE& basicAllocator,
1336 size_type n,
1337 const_void_pointer hint)
1338{
1339 return basicAllocator.allocate(n, hint);
1340}
1341
1342template <class ALLOCATOR_TYPE>
1343inline
1344void
1345allocator_traits<ALLOCATOR_TYPE>::deallocate(ALLOCATOR_TYPE& basicAllocator,
1346 pointer elementAddr,
1347 size_type n)
1348{
1349 basicAllocator.deallocate(elementAddr, n);
1350}
1351
1352// ELEMENT CREATION FUNCTIONS
1353
1354#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1355// {{{ BEGIN GENERATED CODE
1356// Command line: sim_cpp11_features.pl bslma_allocatortraits.h
1357#ifndef BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT
1358#define BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT 14
1359#endif
1360#ifndef BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B
1361#define BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT
1362#endif
1363#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 0
1364template <class ALLOCATOR_TYPE>
1365template <class ELEMENT_TYPE>
1366inline
1367void
1368allocator_traits<ALLOCATOR_TYPE>::construct(ALLOCATOR_TYPE& basicAllocator,
1369 ELEMENT_TYPE *elementAddr)
1370{
1371#if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE)
1372 privateConstruct(basicAllocator,
1373 elementAddr);
1374#else
1375 basicAllocator.construct(
1376 elementAddr);
1377#endif
1378}
1379#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 0
1380
1381#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 1
1382template <class ALLOCATOR_TYPE>
1383template <class ELEMENT_TYPE, class Args_01>
1384inline
1385void
1386allocator_traits<ALLOCATOR_TYPE>::construct(ALLOCATOR_TYPE& basicAllocator,
1387 ELEMENT_TYPE *elementAddr,
1388 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01)
1389{
1390#if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE)
1391 privateConstruct(basicAllocator,
1392 elementAddr,
1393 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01));
1394#else
1395 basicAllocator.construct(
1396 elementAddr, BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01));
1397#endif
1398}
1399#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 1
1400
1401#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 2
1402template <class ALLOCATOR_TYPE>
1403template <class ELEMENT_TYPE, class Args_01,
1404 class Args_02>
1405inline
1406void
1407allocator_traits<ALLOCATOR_TYPE>::construct(ALLOCATOR_TYPE& basicAllocator,
1408 ELEMENT_TYPE *elementAddr,
1409 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
1410 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02)
1411{
1412#if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE)
1413 privateConstruct(basicAllocator,
1414 elementAddr,
1415 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1416 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02));
1417#else
1418 basicAllocator.construct(
1419 elementAddr, BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1420 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02));
1421#endif
1422}
1423#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 2
1424
1425#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 3
1426template <class ALLOCATOR_TYPE>
1427template <class ELEMENT_TYPE, class Args_01,
1428 class Args_02,
1429 class Args_03>
1430inline
1431void
1432allocator_traits<ALLOCATOR_TYPE>::construct(ALLOCATOR_TYPE& basicAllocator,
1433 ELEMENT_TYPE *elementAddr,
1434 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
1435 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
1436 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03)
1437{
1438#if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE)
1439 privateConstruct(basicAllocator,
1440 elementAddr,
1441 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1442 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1443 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03));
1444#else
1445 basicAllocator.construct(
1446 elementAddr, BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1447 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1448 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03));
1449#endif
1450}
1451#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 3
1452
1453#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 4
1454template <class ALLOCATOR_TYPE>
1455template <class ELEMENT_TYPE, class Args_01,
1456 class Args_02,
1457 class Args_03,
1458 class Args_04>
1459inline
1460void
1461allocator_traits<ALLOCATOR_TYPE>::construct(ALLOCATOR_TYPE& basicAllocator,
1462 ELEMENT_TYPE *elementAddr,
1463 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
1464 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
1465 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
1466 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04)
1467{
1468#if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE)
1469 privateConstruct(basicAllocator,
1470 elementAddr,
1471 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1472 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1473 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
1474 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04));
1475#else
1476 basicAllocator.construct(
1477 elementAddr, BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1478 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1479 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
1480 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04));
1481#endif
1482}
1483#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 4
1484
1485#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 5
1486template <class ALLOCATOR_TYPE>
1487template <class ELEMENT_TYPE, class Args_01,
1488 class Args_02,
1489 class Args_03,
1490 class Args_04,
1491 class Args_05>
1492inline
1493void
1494allocator_traits<ALLOCATOR_TYPE>::construct(ALLOCATOR_TYPE& basicAllocator,
1495 ELEMENT_TYPE *elementAddr,
1496 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
1497 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
1498 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
1499 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
1500 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05)
1501{
1502#if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE)
1503 privateConstruct(basicAllocator,
1504 elementAddr,
1505 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1506 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1507 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
1508 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
1509 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05));
1510#else
1511 basicAllocator.construct(
1512 elementAddr, BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1513 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1514 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
1515 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
1516 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05));
1517#endif
1518}
1519#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 5
1520
1521#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 6
1522template <class ALLOCATOR_TYPE>
1523template <class ELEMENT_TYPE, class Args_01,
1524 class Args_02,
1525 class Args_03,
1526 class Args_04,
1527 class Args_05,
1528 class Args_06>
1529inline
1530void
1531allocator_traits<ALLOCATOR_TYPE>::construct(ALLOCATOR_TYPE& basicAllocator,
1532 ELEMENT_TYPE *elementAddr,
1533 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
1534 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
1535 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
1536 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
1537 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
1538 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06)
1539{
1540#if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE)
1541 privateConstruct(basicAllocator,
1542 elementAddr,
1543 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1544 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1545 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
1546 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
1547 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
1548 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06));
1549#else
1550 basicAllocator.construct(
1551 elementAddr, BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1552 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1553 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
1554 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
1555 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
1556 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06));
1557#endif
1558}
1559#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 6
1560
1561#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 7
1562template <class ALLOCATOR_TYPE>
1563template <class ELEMENT_TYPE, class Args_01,
1564 class Args_02,
1565 class Args_03,
1566 class Args_04,
1567 class Args_05,
1568 class Args_06,
1569 class Args_07>
1570inline
1571void
1572allocator_traits<ALLOCATOR_TYPE>::construct(ALLOCATOR_TYPE& basicAllocator,
1573 ELEMENT_TYPE *elementAddr,
1574 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
1575 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
1576 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
1577 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
1578 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
1579 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
1580 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07)
1581{
1582#if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE)
1583 privateConstruct(basicAllocator,
1584 elementAddr,
1585 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1586 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1587 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
1588 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
1589 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
1590 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
1591 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07));
1592#else
1593 basicAllocator.construct(
1594 elementAddr, BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1595 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1596 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
1597 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
1598 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
1599 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
1600 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07));
1601#endif
1602}
1603#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 7
1604
1605#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 8
1606template <class ALLOCATOR_TYPE>
1607template <class ELEMENT_TYPE, class Args_01,
1608 class Args_02,
1609 class Args_03,
1610 class Args_04,
1611 class Args_05,
1612 class Args_06,
1613 class Args_07,
1614 class Args_08>
1615inline
1616void
1617allocator_traits<ALLOCATOR_TYPE>::construct(ALLOCATOR_TYPE& basicAllocator,
1618 ELEMENT_TYPE *elementAddr,
1619 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
1620 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
1621 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
1622 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
1623 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
1624 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
1625 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
1626 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08)
1627{
1628#if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE)
1629 privateConstruct(basicAllocator,
1630 elementAddr,
1631 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1632 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1633 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
1634 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
1635 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
1636 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
1637 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07),
1638 BSLS_COMPILERFEATURES_FORWARD(Args_08, arguments_08));
1639#else
1640 basicAllocator.construct(
1641 elementAddr, BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1642 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1643 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
1644 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
1645 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
1646 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
1647 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07),
1648 BSLS_COMPILERFEATURES_FORWARD(Args_08, arguments_08));
1649#endif
1650}
1651#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 8
1652
1653#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 9
1654template <class ALLOCATOR_TYPE>
1655template <class ELEMENT_TYPE, class Args_01,
1656 class Args_02,
1657 class Args_03,
1658 class Args_04,
1659 class Args_05,
1660 class Args_06,
1661 class Args_07,
1662 class Args_08,
1663 class Args_09>
1664inline
1665void
1666allocator_traits<ALLOCATOR_TYPE>::construct(ALLOCATOR_TYPE& basicAllocator,
1667 ELEMENT_TYPE *elementAddr,
1668 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
1669 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
1670 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
1671 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
1672 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
1673 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
1674 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
1675 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08,
1676 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) arguments_09)
1677{
1678#if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE)
1679 privateConstruct(basicAllocator,
1680 elementAddr,
1681 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1682 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1683 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
1684 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
1685 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
1686 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
1687 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07),
1688 BSLS_COMPILERFEATURES_FORWARD(Args_08, arguments_08),
1689 BSLS_COMPILERFEATURES_FORWARD(Args_09, arguments_09));
1690#else
1691 basicAllocator.construct(
1692 elementAddr, BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1693 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1694 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
1695 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
1696 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
1697 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
1698 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07),
1699 BSLS_COMPILERFEATURES_FORWARD(Args_08, arguments_08),
1700 BSLS_COMPILERFEATURES_FORWARD(Args_09, arguments_09));
1701#endif
1702}
1703#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 9
1704
1705#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 10
1706template <class ALLOCATOR_TYPE>
1707template <class ELEMENT_TYPE, class Args_01,
1708 class Args_02,
1709 class Args_03,
1710 class Args_04,
1711 class Args_05,
1712 class Args_06,
1713 class Args_07,
1714 class Args_08,
1715 class Args_09,
1716 class Args_10>
1717inline
1718void
1719allocator_traits<ALLOCATOR_TYPE>::construct(ALLOCATOR_TYPE& basicAllocator,
1720 ELEMENT_TYPE *elementAddr,
1721 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
1722 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
1723 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
1724 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
1725 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
1726 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
1727 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
1728 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08,
1729 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) arguments_09,
1730 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) arguments_10)
1731{
1732#if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE)
1733 privateConstruct(basicAllocator,
1734 elementAddr,
1735 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1736 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1737 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
1738 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
1739 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
1740 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
1741 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07),
1742 BSLS_COMPILERFEATURES_FORWARD(Args_08, arguments_08),
1743 BSLS_COMPILERFEATURES_FORWARD(Args_09, arguments_09),
1744 BSLS_COMPILERFEATURES_FORWARD(Args_10, arguments_10));
1745#else
1746 basicAllocator.construct(
1747 elementAddr, BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1748 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1749 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
1750 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
1751 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
1752 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
1753 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07),
1754 BSLS_COMPILERFEATURES_FORWARD(Args_08, arguments_08),
1755 BSLS_COMPILERFEATURES_FORWARD(Args_09, arguments_09),
1756 BSLS_COMPILERFEATURES_FORWARD(Args_10, arguments_10));
1757#endif
1758}
1759#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 10
1760
1761#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 11
1762template <class ALLOCATOR_TYPE>
1763template <class ELEMENT_TYPE, class Args_01,
1764 class Args_02,
1765 class Args_03,
1766 class Args_04,
1767 class Args_05,
1768 class Args_06,
1769 class Args_07,
1770 class Args_08,
1771 class Args_09,
1772 class Args_10,
1773 class Args_11>
1774inline
1775void
1776allocator_traits<ALLOCATOR_TYPE>::construct(ALLOCATOR_TYPE& basicAllocator,
1777 ELEMENT_TYPE *elementAddr,
1778 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
1779 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
1780 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
1781 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
1782 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
1783 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
1784 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
1785 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08,
1786 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) arguments_09,
1787 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) arguments_10,
1788 BSLS_COMPILERFEATURES_FORWARD_REF(Args_11) arguments_11)
1789{
1790#if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE)
1791 privateConstruct(basicAllocator,
1792 elementAddr,
1793 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1794 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1795 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
1796 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
1797 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
1798 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
1799 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07),
1800 BSLS_COMPILERFEATURES_FORWARD(Args_08, arguments_08),
1801 BSLS_COMPILERFEATURES_FORWARD(Args_09, arguments_09),
1802 BSLS_COMPILERFEATURES_FORWARD(Args_10, arguments_10),
1803 BSLS_COMPILERFEATURES_FORWARD(Args_11, arguments_11));
1804#else
1805 basicAllocator.construct(
1806 elementAddr, BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1807 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1808 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
1809 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
1810 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
1811 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
1812 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07),
1813 BSLS_COMPILERFEATURES_FORWARD(Args_08, arguments_08),
1814 BSLS_COMPILERFEATURES_FORWARD(Args_09, arguments_09),
1815 BSLS_COMPILERFEATURES_FORWARD(Args_10, arguments_10),
1816 BSLS_COMPILERFEATURES_FORWARD(Args_11, arguments_11));
1817#endif
1818}
1819#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 11
1820
1821#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 12
1822template <class ALLOCATOR_TYPE>
1823template <class ELEMENT_TYPE, class Args_01,
1824 class Args_02,
1825 class Args_03,
1826 class Args_04,
1827 class Args_05,
1828 class Args_06,
1829 class Args_07,
1830 class Args_08,
1831 class Args_09,
1832 class Args_10,
1833 class Args_11,
1834 class Args_12>
1835inline
1836void
1837allocator_traits<ALLOCATOR_TYPE>::construct(ALLOCATOR_TYPE& basicAllocator,
1838 ELEMENT_TYPE *elementAddr,
1839 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
1840 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
1841 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
1842 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
1843 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
1844 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
1845 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
1846 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08,
1847 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) arguments_09,
1848 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) arguments_10,
1849 BSLS_COMPILERFEATURES_FORWARD_REF(Args_11) arguments_11,
1850 BSLS_COMPILERFEATURES_FORWARD_REF(Args_12) arguments_12)
1851{
1852#if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE)
1853 privateConstruct(basicAllocator,
1854 elementAddr,
1855 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1856 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1857 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
1858 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
1859 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
1860 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
1861 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07),
1862 BSLS_COMPILERFEATURES_FORWARD(Args_08, arguments_08),
1863 BSLS_COMPILERFEATURES_FORWARD(Args_09, arguments_09),
1864 BSLS_COMPILERFEATURES_FORWARD(Args_10, arguments_10),
1865 BSLS_COMPILERFEATURES_FORWARD(Args_11, arguments_11),
1866 BSLS_COMPILERFEATURES_FORWARD(Args_12, arguments_12));
1867#else
1868 basicAllocator.construct(
1869 elementAddr, BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1870 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1871 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
1872 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
1873 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
1874 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
1875 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07),
1876 BSLS_COMPILERFEATURES_FORWARD(Args_08, arguments_08),
1877 BSLS_COMPILERFEATURES_FORWARD(Args_09, arguments_09),
1878 BSLS_COMPILERFEATURES_FORWARD(Args_10, arguments_10),
1879 BSLS_COMPILERFEATURES_FORWARD(Args_11, arguments_11),
1880 BSLS_COMPILERFEATURES_FORWARD(Args_12, arguments_12));
1881#endif
1882}
1883#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 12
1884
1885#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 13
1886template <class ALLOCATOR_TYPE>
1887template <class ELEMENT_TYPE, class Args_01,
1888 class Args_02,
1889 class Args_03,
1890 class Args_04,
1891 class Args_05,
1892 class Args_06,
1893 class Args_07,
1894 class Args_08,
1895 class Args_09,
1896 class Args_10,
1897 class Args_11,
1898 class Args_12,
1899 class Args_13>
1900inline
1901void
1902allocator_traits<ALLOCATOR_TYPE>::construct(ALLOCATOR_TYPE& basicAllocator,
1903 ELEMENT_TYPE *elementAddr,
1904 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
1905 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
1906 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
1907 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
1908 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
1909 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
1910 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
1911 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08,
1912 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) arguments_09,
1913 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) arguments_10,
1914 BSLS_COMPILERFEATURES_FORWARD_REF(Args_11) arguments_11,
1915 BSLS_COMPILERFEATURES_FORWARD_REF(Args_12) arguments_12,
1916 BSLS_COMPILERFEATURES_FORWARD_REF(Args_13) arguments_13)
1917{
1918#if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE)
1919 privateConstruct(basicAllocator,
1920 elementAddr,
1921 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1922 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1923 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
1924 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
1925 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
1926 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
1927 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07),
1928 BSLS_COMPILERFEATURES_FORWARD(Args_08, arguments_08),
1929 BSLS_COMPILERFEATURES_FORWARD(Args_09, arguments_09),
1930 BSLS_COMPILERFEATURES_FORWARD(Args_10, arguments_10),
1931 BSLS_COMPILERFEATURES_FORWARD(Args_11, arguments_11),
1932 BSLS_COMPILERFEATURES_FORWARD(Args_12, arguments_12),
1933 BSLS_COMPILERFEATURES_FORWARD(Args_13, arguments_13));
1934#else
1935 basicAllocator.construct(
1936 elementAddr, BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1937 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1938 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
1939 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
1940 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
1941 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
1942 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07),
1943 BSLS_COMPILERFEATURES_FORWARD(Args_08, arguments_08),
1944 BSLS_COMPILERFEATURES_FORWARD(Args_09, arguments_09),
1945 BSLS_COMPILERFEATURES_FORWARD(Args_10, arguments_10),
1946 BSLS_COMPILERFEATURES_FORWARD(Args_11, arguments_11),
1947 BSLS_COMPILERFEATURES_FORWARD(Args_12, arguments_12),
1948 BSLS_COMPILERFEATURES_FORWARD(Args_13, arguments_13));
1949#endif
1950}
1951#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 13
1952
1953#if BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 14
1954template <class ALLOCATOR_TYPE>
1955template <class ELEMENT_TYPE, class Args_01,
1956 class Args_02,
1957 class Args_03,
1958 class Args_04,
1959 class Args_05,
1960 class Args_06,
1961 class Args_07,
1962 class Args_08,
1963 class Args_09,
1964 class Args_10,
1965 class Args_11,
1966 class Args_12,
1967 class Args_13,
1968 class Args_14>
1969inline
1970void
1971allocator_traits<ALLOCATOR_TYPE>::construct(ALLOCATOR_TYPE& basicAllocator,
1972 ELEMENT_TYPE *elementAddr,
1973 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
1974 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
1975 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
1976 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
1977 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
1978 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
1979 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
1980 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08,
1981 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) arguments_09,
1982 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) arguments_10,
1983 BSLS_COMPILERFEATURES_FORWARD_REF(Args_11) arguments_11,
1984 BSLS_COMPILERFEATURES_FORWARD_REF(Args_12) arguments_12,
1985 BSLS_COMPILERFEATURES_FORWARD_REF(Args_13) arguments_13,
1986 BSLS_COMPILERFEATURES_FORWARD_REF(Args_14) arguments_14)
1987{
1988#if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE)
1989 privateConstruct(basicAllocator,
1990 elementAddr,
1991 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
1992 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
1993 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
1994 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
1995 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
1996 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
1997 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07),
1998 BSLS_COMPILERFEATURES_FORWARD(Args_08, arguments_08),
1999 BSLS_COMPILERFEATURES_FORWARD(Args_09, arguments_09),
2000 BSLS_COMPILERFEATURES_FORWARD(Args_10, arguments_10),
2001 BSLS_COMPILERFEATURES_FORWARD(Args_11, arguments_11),
2002 BSLS_COMPILERFEATURES_FORWARD(Args_12, arguments_12),
2003 BSLS_COMPILERFEATURES_FORWARD(Args_13, arguments_13),
2004 BSLS_COMPILERFEATURES_FORWARD(Args_14, arguments_14));
2005#else
2006 basicAllocator.construct(
2007 elementAddr, BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
2008 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
2009 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
2010 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
2011 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
2012 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
2013 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07),
2014 BSLS_COMPILERFEATURES_FORWARD(Args_08, arguments_08),
2015 BSLS_COMPILERFEATURES_FORWARD(Args_09, arguments_09),
2016 BSLS_COMPILERFEATURES_FORWARD(Args_10, arguments_10),
2017 BSLS_COMPILERFEATURES_FORWARD(Args_11, arguments_11),
2018 BSLS_COMPILERFEATURES_FORWARD(Args_12, arguments_12),
2019 BSLS_COMPILERFEATURES_FORWARD(Args_13, arguments_13),
2020 BSLS_COMPILERFEATURES_FORWARD(Args_14, arguments_14));
2021#endif
2022}
2023#endif // BSLMA_ALLOCATORTRAITS_VARIADIC_LIMIT_B >= 14
2024
2025#else
2026// The generated code below is a workaround for the absence of perfect
2027// forwarding in some compilers.
2028template <class ALLOCATOR_TYPE>
2029template <class ELEMENT_TYPE, class... Args>
2030inline
2031void
2032allocator_traits<ALLOCATOR_TYPE>::construct(ALLOCATOR_TYPE& basicAllocator,
2033 ELEMENT_TYPE *elementAddr,
2034 BSLS_COMPILERFEATURES_FORWARD_REF(Args)... arguments)
2035{
2036#if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE)
2037 privateConstruct(basicAllocator,
2038 elementAddr,
2039 BSLS_COMPILERFEATURES_FORWARD(Args, arguments)...);
2040#else
2041 basicAllocator.construct(
2042 elementAddr, BSLS_COMPILERFEATURES_FORWARD(Args, arguments)...);
2043#endif
2044}
2045// }}} END GENERATED CODE
2046#endif
2047
2048template <class ALLOCATOR_TYPE>
2049template <class ELEMENT_TYPE>
2050inline
2051void
2052allocator_traits<ALLOCATOR_TYPE>::destroy(ALLOCATOR_TYPE& stdAllocator,
2053 ELEMENT_TYPE *elementAddr)
2054{
2055// For full C++11 compatibility, this should check for the well-formedness of
2056// the allocator-specific code that is commented out below (via some SFINAE
2057// trickery), and switch to the 'DestructionUtil' implementation only if the
2058// 'destroy' member function is not available.
2059
2060// allocator.destroy(elementAddr);
2061#if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE) && \
2062 defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
2063 privateDestroy(stdAllocator, elementAddr);
2064#else
2065 elementAddr->~ELEMENT_TYPE();
2066 (void) stdAllocator;
2067#endif
2068}
2069
2070template <class ALLOCATOR_TYPE>
2071inline
2074 const ALLOCATOR_TYPE& basicAllocator) BSLS_KEYWORD_NOEXCEPT
2075{
2076#if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE)
2077 return BloombergLP::bslma::
2078 AllocatorTraits_CallMaxSize<ALLOCATOR_TYPE>::max_size(basicAllocator);
2079#else
2080 // Cannot sniff out whether 'basicAllocator.max_size()' is valid in C++03,
2081 // but for now require that allocators have a @ref max_size method and just
2082 // call it.
2083 return basicAllocator.max_size();
2084#endif
2085}
2086
2087template <class ALLOCATOR_TYPE>
2088inline
2089ALLOCATOR_TYPE
2091 const ALLOCATOR_TYPE& rhs)
2092{
2093 return selectOnCopyConstruct(rhs, DelegateSelectMethod());
2094}
2095
2096} // close namespace bsl
2097
2098#else // if ! defined(DEFINED_BSLMA_ALLOCATORTRAITS_H)
2099# error Not valid except when included from bslma_allocatortraits.h
2100#endif // ! defined(COMPILING_BSLMA_ALLOCATORTRAITS_H)
2101
2102#endif // ! defined(INCLUDED_BSLMA_ALLOCATORTRAITS_CPP03)
2103
2104// ----------------------------------------------------------------------------
2105// Copyright 2013 Bloomberg Finance L.P.
2106//
2107// Licensed under the Apache License, Version 2.0 (the "License");
2108// you may not use this file except in compliance with the License.
2109// You may obtain a copy of the License at
2110//
2111// http://www.apache.org/licenses/LICENSE-2.0
2112//
2113// Unless required by applicable law or agreed to in writing, software
2114// distributed under the License is distributed on an "AS IS" BASIS,
2115// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2116// See the License for the specific language governing permissions and
2117// limitations under the License.
2118// ----------------------------- END-OF-FILE ----------------------------------
2119
2120/** @} */
2121/** @} */
2122/** @} */
#define BSLMF_VOIDTYPE(ARG)
Definition bslmf_voidtype.h:343
#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_NOEXCEPT
Definition bsls_keyword.h:674
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
ALLOCATOR const STRING_VIEW_LIKE_TYPE & rhs
Definition bslstl_string.h:3918
Definition baljsn_encoder_testtypes.h:76
Definition bdlbb_blob.h:579
Definition bdldfp_decimal.h:5549
rebind_alloc(const ARG &allocatorArg)
Definition bslma_allocatortraits.h:1224
BloombergLP::bslma::AllocatorTraits_RebindAlloc< ALLOCATOR_TYPE, ELEMENT_TYPE >::type allocator_type
Definition bslma_allocatortraits.h:1221
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
Definition bslmf_enableif.h:530
Definition bslmf_integralconstant.h:261
Definition bslmf_isempty.h:319
Definition bslmf_issame.h:146
const T::value_type * type
should be pointer_traits::rebind of template above
Definition bslma_allocatortraits.h:875
const void * type
should be pointer_traits::rebind of template above
Definition bslma_allocatortraits.h:912
std::ptrdiff_t type
Definition bslma_allocatortraits.h:947
static const bool value
Definition bslma_allocatortraits.h:558
bsl::integral_constant< bool, value > type
Definition bslma_allocatortraits.h:561
static const bool value
Definition bslma_allocatortraits.h:661
bsl::integral_constant< bool, value > type
Definition bslma_allocatortraits.h:663
bsl::integral_constant< bool, value > type
Definition bslma_allocatortraits.h:722
static const bool value
Definition bslma_allocatortraits.h:721
bsl::integral_constant< bool, value > type
Definition bslma_allocatortraits.h:780
static const bool value
Definition bslma_allocatortraits.h:779
bsl::integral_constant< bool, value > type
Definition bslma_allocatortraits.h:629
static const bool value
Definition bslma_allocatortraits.h:627
T::value_type * type
Definition bslma_allocatortraits.h:859
AllocatorTraits_RebindFront< T, U >::type type
Definition bslma_allocatortraits.h:1003
std::size_t type
Definition bslma_allocatortraits.h:929
void * type
should be pointer_traits::rebind of template above
Definition bslma_allocatortraits.h:894