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