BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslma_managedptr_cpp03.h
Go to the documentation of this file.
1/// @file bslma_managedptr_cpp03.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bslma_managedptr_cpp03.h -*-C++-*-
8
9// Automatically generated file. **DO NOT EDIT**
10
11#ifndef INCLUDED_BSLMA_MANAGEDPTR_CPP03
12#define INCLUDED_BSLMA_MANAGEDPTR_CPP03
13
14/// @defgroup bslma_managedptr_cpp03 bslma_managedptr_cpp03
15/// @brief Provide C++03 implementation for bslma_managedptr.h
16/// @addtogroup bsl
17/// @{
18/// @addtogroup bslma
19/// @{
20/// @addtogroup bslma_managedptr_cpp03
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bslma_managedptr_cpp03-purpose"> Purpose</a>
25/// * <a href="#bslma_managedptr_cpp03-classes"> Classes </a>
26/// * <a href="#bslma_managedptr_cpp03-description"> Description </a>
27///
28/// # Purpose {#bslma_managedptr_cpp03-purpose}
29/// Provide C++03 implementation for bslma_managedptr.h
30///
31/// # Classes {#bslma_managedptr_cpp03-classes}
32/// See bslma_managedptr.h for list of classes
33///
34/// @see bslma_managedptr
35///
36/// # Description {#bslma_managedptr_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 09:58:46 2024
48/// Command line: sim_cpp11_features.pl bslma_managedptr.h
49/// @}
50/** @} */
51/** @} */
52
53/** @addtogroup bsl
54 * @{
55 */
56/** @addtogroup bslma
57 * @{
58 */
59/** @addtogroup bslma_managedptr_cpp03
60 * @{
61 */
62
63#ifdef COMPILING_BSLMA_MANAGEDPTR_H
64
65
66namespace bslma {
67
68 // =================================
69 // private struct ManagedPtr_ImpUtil
70 // =================================
71
72/// This `struct` provides a namespace for utility functions used to obtain
73/// the necessary types of pointers.
74struct ManagedPtr_ImpUtil {
75
76 // CLASS METHODS
77
78 /// Return the specified `address` cast as a pointer to `void`, even if
79 /// (the template parameter) `TYPE` is cv-qualified.
80 template <class TYPE>
81 static void *voidify(TYPE *address) BSLS_KEYWORD_NOEXCEPT;
82
83 /// Return the specified `address` of a potentially cv-qualified object
84 /// of the given (template parameter) `TYPE`, cast as a pointer to
85 /// non-cv-qualified `TYPE`.
86 template <class TYPE>
87 static TYPE *unqualify(const volatile TYPE *address) BSLS_KEYWORD_NOEXCEPT;
88};
89 // ============================
90 // private class ManagedPtr_Ref
91 // ============================
92
93/// This class holds a managed pointer reference, returned by the implicit
94/// conversion operator in the class `ManagedPtr`. This class is used to
95/// allow the construction of managed pointers from temporary managed
96/// pointer objects, since temporaries cannot bind to the reference to a
97/// modifiable object used in the copy constructor and copy-assignment
98/// operator for `ManagedPtr`. Note that while no members or methods of
99/// this class template depend on the specified `TARGET_TYPE`, it is
100/// important to carry this type into conversions to support passing
101/// ownership of `ManagedPtr_Members` pointers when assigning or
102/// constructing `ManagedPtr` objects.
103///
104/// See @ref bslma_managedptr_cpp03
105template <class TARGET_TYPE>
106class ManagedPtr_Ref {
107
108 // DATA
109 ManagedPtr_Members *d_base_p; // non-null pointer to the managed state of
110 // a 'ManagedPtr' object
111
112 TARGET_TYPE *d_cast_p; // safely-cast pointer to the referenced
113 // object
114
115 public:
116 // CREATORS
117
118 /// Create a `ManagedPtr_Ref` object having the specified `base` value
119 /// for its `base` attribute, and the specified `target` for its
120 /// `target` attribute. Note that `target` (but not `base`) may be
121 /// null.
122 ManagedPtr_Ref(ManagedPtr_Members *base, TARGET_TYPE *target);
123
124 ManagedPtr_Ref(const ManagedPtr_Ref& original) = default;
125 // Create a 'ManagedPtr_Ref' object having the same 'd_base_p' value as
126 // the specified 'original'. Note that this trivial constructor's
127 // definition is compiler generated.
128
129 /// Destroy this object. Note that the referenced managed object is
130 /// *not* destroyed.
132
133 // MANIPULATORS
134 ManagedPtr_Ref& operator=(const ManagedPtr_Ref& original) = default;
135 // Create a 'ManagedPtr_Ref' object having the same 'd_base_p' as the
136 // specified 'original'. Note that this trivial copy-assignment
137 // operator's definition is compiler generated.
138
139 // ACCESSORS
140
141 /// Return a pointer to the managed state of a `ManagedPtr` object.
142 ManagedPtr_Members *base() const;
143
144 /// Return a pointer to the referenced object.
145 TARGET_TYPE *target() const;
146};
147
148 // =========================================
149 // private struct ManagedPtr_TraitConstraint
150 // =========================================
151
152/// This `struct` is an empty type that exists solely to enable constructor
153/// access to be constrained by type trait.
154struct ManagedPtr_TraitConstraint {
155};
156 // ================
157 // class ManagedPtr
158 // ================
159
160/// This class is a "smart pointer" that refers to a *target* object
161/// accessed via a pointer to the specified parameter type, `TARGET_TYPE`,
162/// and that supports sole ownership of a *managed* object that is
163/// potentially of a different type, and may be an entirely different object
164/// from the target object. A managed pointer ensures that the object it
165/// manages is destroyed when the managed pointer is destroyed (or
166/// re-assigned), using the "deleter" supplied along with the managed
167/// object. The target object referenced by a managed pointer may be
168/// accessed using either the `->` operator, or the dereference operator
169/// (`operator *`). The specified `TARGET_TYPE` may be `const`-qualified,
170/// but may not be `volatile`-qualified, nor may it be a reference type.
171///
172/// A managed pointer may be *empty*, in which case it neither refers to a
173/// target object nor owns a managed object. An empty managed pointer is
174/// the equivalent of a null pointer: Such a managed pointer is not
175/// de-referenceable, and tests as `false` in boolean expressions.
176///
177/// A managed pointer for which the managed object is not the same object as
178/// the target is said to *alias* the managed object (see the section
179/// "Aliasing" in the component-level documentation).
180///
181/// See @ref bslma_managedptr_cpp03
182template <class TARGET_TYPE>
183class ManagedPtr {
184
185 public:
186 // INTERFACE TYPES
187
188 /// Alias for a function-pointer type for functions used to destroy the
189 /// object managed by a `ManagedPtr` object.
191
192 /// Alias to the `TARGET_TYPE` template parameter.
193 typedef TARGET_TYPE element_type;
194
195 private:
196 // PRIVATE TYPES
197
198 /// `BoolType` is an alias for an unspecified type that is implicitly
199 /// convertible to `bool`, but will not promote to `int`. This (opaque)
200 /// type can be used as an "unspecified boolean type" for converting a
201 /// managed pointer to `bool` in contexts such as `if (mp) { ... }`
202 /// without actually having a conversion to `bool` or being less-than
203 /// comparable (either of which would also enable undesirable implicit
204 /// comparisons of managed pointers to `int` and less-than comparisons).
205 typedef typename bsls::UnspecifiedBool<ManagedPtr>::BoolType BoolType;
206
207 /// This `typedef` is a convenient alias for the utility associated with
208 /// movable references.
209 typedef bslmf::MovableRefUtil MoveUtil;
210
211 // DATA
212 ManagedPtr_Members d_members; // state managed by this object
213
214 // PRIVATE CLASS METHODS
215
216 /// Return the value of the specified `ptr` as a `void *`, after
217 /// stripping all `const` and `volatile` qualifiers from `TARGET_TYPE`.
218 /// This function avoids accidental type-safety errors when performing
219 /// the necessary sequence of casts. Note that calling this function
220 /// implies a conversion of the calling pointer to `TARGET_TYPE *`,
221 /// which, in rare cases, may involve some adjustment of the pointer
222 /// value, e.g., in the case of multiple inheritance where `TARGET_TYPE`
223 /// is not a left-most base of the complete object type.
224 static void *stripBasePointerType(TARGET_TYPE *ptr);
225
226 /// Return the value of the specified `ptr` as a `void *`, after
227 /// stripping all `const` and `volatile` qualifiers from `MANAGED_TYPE`.
228 /// This function avoids accidental type-safety errors when performing
229 /// the necessary sequence of casts.
230 template <class MANAGED_TYPE>
231 static void *stripCompletePointerType(MANAGED_TYPE *ptr);
232
233 // PRIVATE MANIPULATORS
234
235 /// Destroy the currently managed object, if any. Then, set the target
236 /// object of this managed pointer to be that referenced by the
237 /// specified `ptr`, take ownership of `*ptr` as the currently managed
238 /// object, and set a deleter that will invoke the specified `deleter`
239 /// with the address of the currently managed object, and with the
240 /// specified `cookie` (that the deleter can use for its own purposes),
241 /// unless `0 == ptr`, in which case reset this managed pointer to
242 /// empty. The behavior is undefined if `ptr` is already managed by
243 /// another object, or if `0 == deleter && 0 != ptr`.
244 template <class MANAGED_TYPE>
245 void loadImp(MANAGED_TYPE *ptr, void *cookie, DeleterFunc deleter);
246
247 private:
248 // NOT IMPLEMENTED
249
250 /// It is never defined behavior to pass a null pointer literal as a
251 /// factory, unless the specified `ptr` is also a null pointer literal.
252 template <class MANAGED_TYPE>
253 ManagedPtr(MANAGED_TYPE *, bsl::nullptr_t);
254
255 private:
256 // NOT IMPLEMENTED
257
258 /// It is never defined behavior to pass a null literal as a deleter,
259 /// unless the `object` pointer is also a null pointer literal.
260 template <class MANAGED_TYPE, class COOKIE_TYPE>
261 ManagedPtr(MANAGED_TYPE *, COOKIE_TYPE *, bsl::nullptr_t);
262
263 private:
264 // NOT IMPLEMENTED
265
266 /// It is never defined behavior to pass a null literal as a deleter,
267 /// unless the `object` pointer is also a null pointer literal.
268 template <class MANAGED_TYPE>
269 void load(MANAGED_TYPE *, bsl::nullptr_t, bsl::nullptr_t);
270 template <class COOKIE_TYPE>
271 void load(TARGET_TYPE *, COOKIE_TYPE *, bsl::nullptr_t);
272
273 private:
274 // NOT IMPLEMENTED
275
276 /// These two operator overloads are declared as `private` but never
277 /// defined in order to eliminate accidental equality comparisons that
278 /// would occur through the implicit conversion to `BoolType`. Note
279 /// that the return type of `void` is chosen as it will often produce a
280 /// clearer error message than relying on the `private` control failure.
281 /// Also note that these private operators will not be needed with
282 /// C++11, where an `explicit operator bool()` conversion operator would
283 /// be preferred.
284 void operator==(const ManagedPtr&) const;
285 void operator!=(const ManagedPtr&) const;
286
287 // FRIENDS
288 template <class ALIASED_TYPE>
289 friend class ManagedPtr; // required only for alias support
290
291 public:
292 // CREATORS
293
294 /// Create an empty managed pointer.
295 ManagedPtr();
296
297 /// Create a managed pointer having a target object referenced by the
298 /// specified `ptr`, owning the managed object `*ptr`, and having a
299 /// deleter that will call `delete ptr` to destroy the managed object
300 /// when invoked (e.g., when this managed pointer object is destroyed),
301 /// unless `0 == ptr`, in which case create an empty managed pointer.
302 /// The deleter will invoke the destructor of `MANAGED_TYPE` rather than
303 /// the destructor of `TARGET_TYPE`. This constructor will not compile
304 /// unless `MANAGED_TYPE *` is convertible to `TARGET_TYPE *`. Note
305 /// that this behavior allows `ManagedPtr` to be defined for `void`
306 /// pointers, and to call the correct destructor for the managed object,
307 /// even if the destructor for `TARGET_TYPE` is not declared as
308 /// `virtual`. The behavior is undefined unless the managed object (if
309 /// any) can be destroyed by `delete`, or if the lifetime of the managed
310 /// object is already managed by another object.
311 template <class MANAGED_TYPE>
312 explicit ManagedPtr(MANAGED_TYPE *ptr);
313
314 /// Create a managed pointer having the same target object as the
315 /// managed pointer referenced by the specified `ref`, transfer
316 /// ownership of the managed object owned by the managed pointer
317 /// referenced by `ref`, and reset the managed pointer referenced by
318 /// `ref` to empty. This constructor is used to create a managed
319 /// pointer from a managed pointer rvalue, or from a managed pointer to
320 /// a "compatible" type, where "compatible" means a built-in conversion
321 /// from `COMPATIBLE_TYPE *` to `TARGET_TYPE *` is defined, e.g.,
322 /// `derived *` to `base *`, `T *` to `const T *`, or `T *` to `void *`.
323 ManagedPtr(ManagedPtr_Ref<TARGET_TYPE> ref)
324 BSLS_KEYWORD_NOEXCEPT; // IMPLICIT
325
327
328 /// Create a managed pointer having the same target object as the
329 /// specified `original`, transfer ownership of the object managed by
330 /// `original` (if any) to this managed pointer, and reset `original` to
331 /// empty.
333
334 /// Create a managed pointer having the same target object as the specified
335 /// `original`, transfer ownership of the object managed by `original` (if
336 /// any) to this managed pointer, and reset `original` to empty.
337 /// `TARGET_TYPE` must be an accessible and unambiguous base of
338 /// `BDE_OTHER_TYPE`
339#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
340 template <class BDE_OTHER_TYPE>
341 ManagedPtr(ManagedPtr<BDE_OTHER_TYPE>&& original,
342 typename bsl::enable_if<
344 ManagedPtr_TraitConstraint>::type =
345 ManagedPtr_TraitConstraint())
347#elif defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
348 // sun compiler version 12.3 and earlier
349 template <class BDE_OTHER_TYPE>
350 ManagedPtr(bslmf::MovableRef<ManagedPtr<BDE_OTHER_TYPE> > original)
352#else // c++03 except old (version <= 12.3) sun compilers
353 template <class BDE_OTHER_TYPE>
354 ManagedPtr(bslmf::MovableRef<ManagedPtr<BDE_OTHER_TYPE> > original,
355 typename bsl::enable_if<
357 ManagedPtr_TraitConstraint>::type =
358 ManagedPtr_TraitConstraint())
360#endif
361
362 /// Create a managed pointer that takes ownership of the object managed
363 /// by the specified `alias`, but which uses the specified `ptr` to
364 /// refer to its target object, unless `0 == ptr`, in which case create
365 /// an empty managed pointer. Reset `alias` to empty if ownership of
366 /// its managed object is transferred. The behavior is undefined if
367 /// `alias` is empty, but `0 != ptr`. Note that destroying or
368 /// re-assigning a managed pointer created with this constructor will
369 /// destroy the object originally managed by `alias` (unless `release`
370 /// is called first); the destructor for `*ptr` is not called directly.
371 template <class ALIASED_TYPE>
372 ManagedPtr(ManagedPtr<ALIASED_TYPE>& alias, TARGET_TYPE *ptr);
373 template <class ALIASED_TYPE>
374#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
375 ManagedPtr(ManagedPtr<ALIASED_TYPE>&& alias,
376#else
377 ManagedPtr(bslmf::MovableRef<ManagedPtr<ALIASED_TYPE> > alias,
378#endif
379 TARGET_TYPE *ptr);
380
381 /// Create a managed pointer having a target object referenced by the
382 /// specified `ptr`, owning the managed object `*ptr`, and having a
383 /// deleter that will call `factory->deleteObject(ptr)` to destroy the
384 /// managed object when invoked (e.g., when this managed pointer object
385 /// is destroyed), unless `0 == ptr`, in which case create an empty
386 /// managed pointer. The deleter will invoke the destructor of
387 /// `MANAGED_TYPE` rather than the destructor of `TARGET_TYPE`. This
388 /// constructor will not compile unless `MANAGED_TYPE *` is convertible
389 /// to `TARGET_TYPE *`. The behavior is undefined unless the managed
390 /// object (if any) can be destroyed by the specified `factory`, or if
391 /// `0 == factory && 0 != ptr`, or if the lifetime of the managed object
392 /// is already managed by another object. Note that `bslma::Allocator`,
393 /// and any class publicly and unambiguously derived from
394 /// `bslma::Allocator`, meets the requirements for `FACTORY_TYPE`.
395 template <class MANAGED_TYPE, class FACTORY_TYPE>
396 ManagedPtr(MANAGED_TYPE *ptr, FACTORY_TYPE *factory);
397
398 /// Create an empty managed pointer. Note that this constructor is
399 /// necessary to match null-pointer literal arguments, in order to break
400 /// ambiguities and provide valid type deduction with the other
401 /// constructor templates in this class.
403
404 /// Create an empty managed pointer. Note that the specified `factory`
405 /// is ignored, as an empty managed pointer does not call its deleter.
406 template <class FACTORY_TYPE>
407 ManagedPtr(bsl::nullptr_t, FACTORY_TYPE *factory);
408
409 /// Create a managed pointer having a target object referenced by the
410 /// specified `ptr`, owning the managed object `*ptr`, and having a
411 /// deleter that will invoke the specified `deleter` with the address of
412 /// the currently managed object, and with the specified `cookie` (that
413 /// the deleter can use for its own purposes), unless `0 == ptr`, in
414 /// which case create an empty managed pointer. The behavior is
415 /// undefined if `ptr` is already managed by another object, or if
416 /// `0 == deleter && 0 != ptr`. Note that this constructor is required
417 /// only because the deprecated overloads cause an ambiguity in its
418 /// absence; it should be removed when the deprecated overloads are
419 /// removed.
420 ManagedPtr(TARGET_TYPE *ptr, void *cookie, DeleterFunc deleter);
421
422 /// Create a managed pointer having a target object referenced by the
423 /// specified `ptr`, owning the managed object `*ptr`, and having a
424 /// deleter that will invoke the specified `deleter` with the address of
425 /// the currently managed object, and with the specified `cookie` (that
426 /// the deleter can use for its own purposes), unless `0 == ptr`, in
427 /// which case create an empty managed pointer. This constructor will
428 /// not compile unless `MANAGED_TYPE *` is convertible to
429 /// `TARGET_TYPE *`. The deleter will invoke the destructor of
430 /// `MANAGED_TYPE` rather than the destructor of `TARGET_TYPE`. The
431 /// behavior is undefined if `ptr` is already managed by another object,
432 /// or if `0 == deleter && 0 != ptr`.
433 template <class MANAGED_TYPE>
434 ManagedPtr(MANAGED_TYPE *ptr, void *cookie, DeleterFunc deleter);
435
436#ifndef BDE_OMIT_INTERNAL_DEPRECATED
437 /// [**DEPRECATED**]: Instead, use:
438 /// @code
439 /// template <class MANAGED_TYPE>
440 /// ManagedPtr(MANAGED_TYPE *ptr, void *cookie, DeleterFunc deleter);
441 /// @endcode
442 /// Create a managed pointer having a target object referenced by the
443 /// specified `ptr`, owning the managed object `*ptr`, and having a
444 /// deleter that will invoke the specified `deleter` with the address of
445 /// the currently managed object, and with the specified `cookie` (that
446 /// the deleter can use for its own purposes), unless `0 == ptr`, in
447 /// which case create an empty managed pointer. This constructor will
448 /// not compile unless `MANAGED_TYPE *` is convertible to
449 /// `TARGET_TYPE *`, and `MANAGED_TYPE *` is convertible to
450 /// `MANAGED_BASE *`. The deleter will invoke the destructor of
451 /// `MANAGED_TYPE` rather than the destructor of `TARGET_TYPE`. The
452 /// behavior is undefined if `ptr` is already managed by another object,
453 /// or if `0 == deleter && 0 != ptr`. Note that this constructor is
454 /// needed only to avoid ambiguous type deductions when passing a null
455 /// pointer literal as the `cookie` when the user passes a deleter
456 /// taking a type other than `void *` for its object type. Also note
457 /// that this function is *deprecated* as it relies on undefined
458 /// compiler behavior for its implementation (that luckily performs as
459 /// required on every platform supported by BDE).
460 template <class MANAGED_TYPE, class MANAGED_BASE>
461 ManagedPtr(MANAGED_TYPE *ptr,
462 void *cookie,
463 void (*deleter)(MANAGED_BASE *, void *));
464
465 /// [**DEPRECATED**]: Instead, use:
466 /// @code
467 /// template <class MANAGED_TYPE>
468 /// ManagedPtr(MANAGED_TYPE *ptr, void *cookie, DeleterFunc deleter);
469 /// @endcode
470 /// Create a managed pointer having a target object referenced by the
471 /// specified `ptr`, owning the managed object `*ptr`, and having a
472 /// deleter that will invoke the specified `deleter` with the address of
473 /// the currently managed object, and with the specified `cookie` (that
474 /// the deleter can use for its own purposes), unless `0 == ptr`, in
475 /// which case create an empty managed pointer. This constructor will
476 /// not compile unless `MANAGED_TYPE *` is convertible to
477 /// `TARGET_TYPE *`, and `MANAGED_TYPE *` is convertible to
478 /// `MANAGED_BASE *`. The deleter will invoke the destructor of
479 /// `MANAGED_TYPE` rather than the destructor of `TARGET_TYPE`. The
480 /// behavior is undefined if `ptr` is already managed by another object,
481 /// or if `0 == deleter && 0 != ptr`. Note that this function is
482 /// *deprecated* as it relies on undefined compiler behavior for its
483 /// implementation (that luckily performs as required on every platform
484 /// supported by BDE).
485 template <class MANAGED_TYPE,
486 class MANAGED_BASE,
487 class COOKIE_TYPE,
488 class COOKIE_BASE>
489 ManagedPtr(MANAGED_TYPE *ptr,
490 COOKIE_TYPE *cookie,
491 void (*deleter)(MANAGED_BASE *, COOKIE_BASE *));
492#endif // BDE_OMIT_INTERNAL_DEPRECATED
493
494 /// Destroy this managed pointer object. Destroy the object managed by
495 /// this managed pointer by invoking the user-supplied deleter, unless
496 /// this managed pointer is empty, in which case the deleter will *not*
497 /// be called.
498 ~ManagedPtr();
499
500 // MANIPULATORS
502
503 /// If this object and the specified `rhs` manage the same object,
504 /// return a reference to this managed pointer; otherwise, destroy the
505 /// managed object owned by this managed pointer, transfer ownership of
506 /// the managed object owned by `rhs` to this managed pointer, set this
507 /// managed pointer to point to the target object referenced by `rhs`,
508 /// reset `rhs` to empty, and return a reference to this managed
509 /// pointer.
512
513 /// If this object and the specified `rhs` manage the same object,
514 /// return a reference to this managed pointer; otherwise, destroy the
515 /// managed object owned by this managed pointer, transfer ownership of
516 /// the managed object owned by `rhs` to this managed pointer, set this
517 /// managed pointer to point to the target object referenced by `rhs`,
518 /// reset `rhs` to empty, and return a reference to this managed
519 /// pointer. `TARGET_TYPE` must be an accessible and unambiguous base
520 /// of `BDE_OTHER_TYPE`
521#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
522 template <class BDE_OTHER_TYPE>
523 typename bsl::enable_if<
525 ManagedPtr<TARGET_TYPE> >::type&
526 operator=(ManagedPtr<BDE_OTHER_TYPE>&& rhs) BSLS_KEYWORD_NOEXCEPT;
527#elif defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
528 // sun compiler version 12.3 and earlier
529 template <class BDE_OTHER_TYPE>
530 ManagedPtr<TARGET_TYPE>&
531 operator=(bslmf::MovableRef<ManagedPtr<BDE_OTHER_TYPE> > rhs)
533#else // c++03 except old (version <= 12.3) sun compilers
534 template <class BDE_OTHER_TYPE>
535 typename bsl::enable_if<
537 ManagedPtr<TARGET_TYPE> >::type&
538 operator=(bslmf::MovableRef<ManagedPtr<BDE_OTHER_TYPE> > rhs)
540#endif
541
542 /// If this object and the managed pointer reference by the specified
543 /// `ref` manage the same object, return a reference to this managed
544 /// pointer; otherwise, destroy the managed object owned by this managed
545 /// pointer, transfer ownership of the managed object owned by the
546 /// managed pointer referenced by `ref`, and set this managed pointer to
547 /// point to the target object currently referenced the managed pointer
548 /// referenced by `ref`; then reset the managed pointer referenced by
549 /// `ref` to empty, and return a reference to this managed pointer.
550 /// This operator is (implicitly) used to assign from a managed pointer
551 /// rvalue, or from a managed pointer to a "compatible" type, where
552 /// "compatible" means a built-in conversion from `MANAGED_TYPE *` to
553 /// `TARGET_TYPE *` is defined, e.g., `derived *` to `base *`, `T *` to
554 /// `const T *`, or `T *` to `void *`.
555 ManagedPtr& operator=(ManagedPtr_Ref<TARGET_TYPE> ref)
557
558 /// Destroy the current managed object (if any) and reset this managed
559 /// pointer to empty.
561
562 /// Return a managed pointer reference, referring to this object. Note
563 /// that this conversion operator is used implicitly to allow the
564 /// construction of managed pointers from rvalues because temporaries
565 /// cannot be passed by references offering modifiable access.
566 template <class REFERENCED_TYPE>
567 operator ManagedPtr_Ref<REFERENCED_TYPE>();
568
569 /// [**DEPRECATED**] Use `reset` instead.
570 ///
571 /// Destroy the current managed object (if any) and reset this managed
572 /// pointer to empty.
573 void clear();
574
575 /// Destroy the currently managed object, if any. Then, set the target
576 /// object of this managed pointer to be that referenced by the
577 /// specified `ptr`, take ownership of `*ptr` as the currently managed
578 /// object, and set a deleter that uses the currently installed default
579 /// allocator to destroy the managed object when invoked (e.g., when
580 /// this managed pointer object is destroyed), unless `0 == ptr`, in
581 /// which case reset this managed pointer to empty. The deleter will
582 /// invoke the destructor of `MANAGED_TYPE` rather than the destructor
583 /// of `TARGET_TYPE`. This function will not compile unless
584 /// `MANAGED_TYPE *` is convertible to `TARGET_TYPE *`. The behavior is
585 /// undefined unless the managed object (if any) can be destroyed by the
586 /// currently installed default allocator, or if the lifetime of the
587 /// managed object is already managed by another object.
588 template <class MANAGED_TYPE>
589 void load(MANAGED_TYPE *ptr);
590
591 /// Destroy the currently managed object, if any. Then, set the target
592 /// object of this managed pointer to be that referenced by the
593 /// specified `ptr`, take ownership of `*ptr` as the currently managed
594 /// object, and set a deleter that calls `factory->deleteObject(ptr)` to
595 /// destroy the managed object when invoked (e.g., when this managed
596 /// pointer object is destroyed), unless `0 == ptr`, in which case reset
597 /// this managed pointer to empty. The deleter will invoke the
598 /// destructor of `MANAGED_TYPE` rather than the destructor of
599 /// `TARGET_TYPE`. This function will not compile unless
600 /// `MANAGED_TYPE *` is convertible to `TARGET_TYPE *`. The behavior is
601 /// undefined unless the managed object (if any) can be destroyed by the
602 /// specified `factory`, or if `0 == factory && 0 != ptr`, or if the
603 /// the lifetime of the managed object is already managed by another
604 /// object. Note that `bslma::Allocator`, and any class publicly and
605 /// unambiguously derived from `bslma::Allocator`, meets the
606 /// requirements for `FACTORY_TYPE`.
607 template <class MANAGED_TYPE, class FACTORY_TYPE>
608 void load(MANAGED_TYPE *ptr, FACTORY_TYPE *factory);
609
610 /// Destroy the currently managed object, if any. Then, set the target
611 /// object of this managed pointer to be that referenced by the
612 /// specified `ptr`, take ownership of `*ptr` as the currently managed
613 /// object, and set a deleter that will invoke the specified `deleter`
614 /// with the address of the currently managed object, and with the
615 /// specified `cookie` (that the deleter can use for its own purposes),
616 /// unless `0 == ptr`, in which case reset this managed pointer to
617 /// empty. The behavior is undefined if `ptr` is already managed by
618 /// another object, or if `0 == deleter && 0 != ptr`. Note that GCC 3.4
619 /// and earlier versions have a bug in template type deduction/overload
620 /// resolution that causes ambiguities if this signature is available.
621 /// This function will be restored on that platform once the deprecated
622 /// signatures are finally removed.
623 template <class MANAGED_TYPE>
624 void load(MANAGED_TYPE *ptr, void *cookie, DeleterFunc deleter);
625
626 /// Destroy the current managed object (if any) and reset this managed
627 /// pointer to empty. Note that the optionally specified `cookie` and
628 /// `deleter` will be ignored, as empty managed pointers do not invoke a
629 /// deleter.
630 void load(bsl::nullptr_t = 0, void *cookie = 0, DeleterFunc deleter = 0);
631
632#ifndef BDE_OMIT_INTERNAL_DEPRECATED
633 template <class MANAGED_TYPE, class COOKIE_TYPE>
634 void load(MANAGED_TYPE *ptr, COOKIE_TYPE *cookie, DeleterFunc deleter);
635
636 template <class MANAGED_TYPE, class MANAGED_BASE>
637 void load(MANAGED_TYPE *ptr,
638 void *cookie,
639 void (*deleter)(MANAGED_BASE *, void *));
640
641 /// [**DEPRECATED**]: Instead, use:
642 /// @code
643 /// template <class MANAGED_TYPE>
644 /// void load(MANAGED_TYPE *ptr, void *cookie, DeleterFunc deleter);
645 /// @endcode
646 /// Destroy the currently managed object, if any. Then, set the target
647 /// object of this managed pointer to be that referenced by the
648 /// specified `ptr`, take ownership of `*ptr` as the currently managed
649 /// object, and set a deleter that will invoke the specified `deleter`
650 /// with the address of the currently managed object, and with the
651 /// specified `cookie` (that the deleter can use for its own purposes),
652 /// unless `0 == ptr`, in which case reset this managed pointer to
653 /// empty. The behavior is undefined if `ptr` is already managed by
654 /// another object, or if `0 == deleter && 0 != ptr`. Note that this
655 /// function is *deprecated* as it relies on undefined compiler behavior
656 /// for its implementation, but luckily perform as required for all
657 /// currently supported platforms; on platforms where the non-deprecated
658 /// overload is not available (e.g., GCC 3.4) code should be written as
659 /// if it were available, as an appropriate (deprecated) overload will
660 /// be selected with the correct (non-deprecated) behavior.
661 template <class MANAGED_TYPE,
662 class MANAGED_BASE,
663 class COOKIE_TYPE,
664 class COOKIE_BASE>
665 void load(MANAGED_TYPE *ptr,
666 COOKIE_TYPE *cookie,
667 void (*deleter)(MANAGED_BASE *, COOKIE_BASE *));
668#endif // BDE_OMIT_INTERNAL_DEPRECATED
669
670 /// If the specified `alias` manages the same object as this managed
671 /// pointer, set the target object of this managed pointer to be that
672 /// referenced by the specified `ptr`; otherwise, destroy the currently
673 /// managed object (if any), and if `alias` is empty, reset this managed
674 /// pointer to empty; otherwise, transfer ownership (and the deleter) of
675 /// the object managed by `alias`, and set the target object of this
676 /// managed pointer to be that referenced by `ptr`. The behavior is
677 /// undefined if `0 == ptr` and `alias` is not empty, or if `0 != ptr`
678 /// and `alias` is empty, or if `ptr` is already managed by a managed
679 /// pointer other than `alias`. Note that this establishes a managed
680 /// pointer where `ptr` aliases `alias`. The managed object for `alias`
681 /// will ultimately be destroyed, and the destructor for `ptr` is not
682 /// called directly.
683 template <class ALIASED_TYPE>
684 void loadAlias(ManagedPtr<ALIASED_TYPE>& alias, TARGET_TYPE *ptr);
685
686 /// Return a raw pointer to the current target object (if any) and the
687 /// deleter for the currently managed object, and reset this managed
688 /// pointer to empty. It is undefined behavior to run the returned
689 /// deleter unless the returned pointer to target object is not null.
690 ManagedPtr_PairProxy<TARGET_TYPE, ManagedPtrDeleter> release();
691
692 /// Load the specified `deleter` for the currently managed object and
693 /// reset this managed pointer to empty. Return a raw pointer to the
694 /// target object (if any) managed by this pointer. It is undefined
695 /// behavior to run the returned deleter unless the returned pointer to
696 /// target object is not null.
697 TARGET_TYPE *release(ManagedPtrDeleter *deleter);
698
699 /// Destroy the current managed object (if any) and reset this managed
700 /// pointer to empty.
701 void reset();
702
703 /// Exchange the value and ownership of this managed pointer with the
704 /// specified `other` managed pointer.
705 void swap(ManagedPtr& other);
706
707 // ACCESSORS
708
709 /// Return a value of "unspecified bool" type that evaluates to `false`
710 /// if this managed pointer is empty, and `true` otherwise. Note that
711 /// this conversion operator allows a managed pointer to be used within
712 /// a conditional context, such as within an `if` or `while` statement,
713 /// but does *not* allow managed pointers to be compared (e.g., via `<`
714 /// or `>`). Also note that a superior solution is available in C++11
715 /// using the `explicit operator bool()` syntax, that removes the need
716 /// for a special boolean-like type and private equality-comparison
717 /// operators.
718 operator BoolType() const;
719
720 /// Return a reference to the target object. The behavior is undefined
721 /// if this managed pointer is empty, or if `TARGET_TYPE` is `void` or
722 /// `const void`.
724
725 /// Return the address of the target object, or 0 if this managed
726 /// pointer is empty.
727 TARGET_TYPE *operator->() const;
728
729 /// Return a reference to the non-modifiable deleter information
730 /// associated with this managed pointer. The behavior is undefined if
731 /// this managed pointer is empty.
732 const ManagedPtrDeleter& deleter() const;
733
734 /// Return the address of the target object, or 0 if this managed
735 /// pointer is empty.
736 TARGET_TYPE *get() const;
737
738 /// [**DEPRECATED**]: Use `get` instead.
739 ///
740 /// Return the address of the target object, or 0 if this managed
741 /// pointer is empty.
742 TARGET_TYPE *ptr() const;
743};
744
745// FREE FUNCTIONS
746
747/// Efficiently exchange the values of the specified `a` and `b` objects.
748/// This function provides the no-throw exception-safety guarantee.
749template <class TARGET_TYPE>
750void swap(ManagedPtr<TARGET_TYPE>& a, ManagedPtr<TARGET_TYPE>& b);
751
752 // =====================
753 // struct ManagedPtrUtil
754 // =====================
755
756/// This utility class provides a general no-op deleter, which is useful
757/// when creating managed pointers to stack-allocated objects.
758struct ManagedPtrUtil {
759
760 // CLASS METHODS
761
762 /// Deleter function that does nothing.
763 static void noOpDeleter(void *, void *);
764
765#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
766// {{{ BEGIN GENERATED CODE
767// Command line: sim_cpp11_features.pl bslma_managedptr.h
768#ifndef BSLMA_MANAGEDPTR_VARIADIC_LIMIT
769#define BSLMA_MANAGEDPTR_VARIADIC_LIMIT 14
770#endif
771#ifndef BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A
772#define BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A BSLMA_MANAGEDPTR_VARIADIC_LIMIT
773#endif
774
775#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 0
776 template <class ELEMENT_TYPE>
777 static ManagedPtr<ELEMENT_TYPE>
779#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 0
780
781#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 1
782 template <class ELEMENT_TYPE, class ARGS_01>
783 static ManagedPtr<ELEMENT_TYPE>
785 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01);
786#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 1
787
788#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 2
789 template <class ELEMENT_TYPE, class ARGS_01,
790 class ARGS_02>
791 static ManagedPtr<ELEMENT_TYPE>
793 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
794 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02);
795#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 2
796
797#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 3
798 template <class ELEMENT_TYPE, class ARGS_01,
799 class ARGS_02,
800 class ARGS_03>
801 static ManagedPtr<ELEMENT_TYPE>
803 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
804 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
805 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03);
806#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 3
807
808#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 4
809 template <class ELEMENT_TYPE, class ARGS_01,
810 class ARGS_02,
811 class ARGS_03,
812 class ARGS_04>
813 static ManagedPtr<ELEMENT_TYPE>
815 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
816 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
817 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
818 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04);
819#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 4
820
821#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 5
822 template <class ELEMENT_TYPE, class ARGS_01,
823 class ARGS_02,
824 class ARGS_03,
825 class ARGS_04,
826 class ARGS_05>
827 static ManagedPtr<ELEMENT_TYPE>
829 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
830 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
831 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
832 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
833 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05);
834#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 5
835
836#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 6
837 template <class ELEMENT_TYPE, class ARGS_01,
838 class ARGS_02,
839 class ARGS_03,
840 class ARGS_04,
841 class ARGS_05,
842 class ARGS_06>
843 static ManagedPtr<ELEMENT_TYPE>
845 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
846 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
847 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
848 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
849 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
850 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06);
851#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 6
852
853#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 7
854 template <class ELEMENT_TYPE, class ARGS_01,
855 class ARGS_02,
856 class ARGS_03,
857 class ARGS_04,
858 class ARGS_05,
859 class ARGS_06,
860 class ARGS_07>
861 static ManagedPtr<ELEMENT_TYPE>
863 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
864 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
865 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
866 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
867 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
868 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
869 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07);
870#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 7
871
872#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 8
873 template <class ELEMENT_TYPE, class ARGS_01,
874 class ARGS_02,
875 class ARGS_03,
876 class ARGS_04,
877 class ARGS_05,
878 class ARGS_06,
879 class ARGS_07,
880 class ARGS_08>
881 static ManagedPtr<ELEMENT_TYPE>
883 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
884 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
885 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
886 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
887 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
888 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
889 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
890 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08);
891#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 8
892
893#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 9
894 template <class ELEMENT_TYPE, class ARGS_01,
895 class ARGS_02,
896 class ARGS_03,
897 class ARGS_04,
898 class ARGS_05,
899 class ARGS_06,
900 class ARGS_07,
901 class ARGS_08,
902 class ARGS_09>
903 static ManagedPtr<ELEMENT_TYPE>
905 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
906 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
907 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
908 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
909 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
910 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
911 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
912 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
913 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09);
914#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 9
915
916#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 10
917 template <class ELEMENT_TYPE, class ARGS_01,
918 class ARGS_02,
919 class ARGS_03,
920 class ARGS_04,
921 class ARGS_05,
922 class ARGS_06,
923 class ARGS_07,
924 class ARGS_08,
925 class ARGS_09,
926 class ARGS_10>
927 static ManagedPtr<ELEMENT_TYPE>
929 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
930 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
931 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
932 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
933 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
934 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
935 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
936 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
937 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
938 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10);
939#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 10
940
941#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 11
942 template <class ELEMENT_TYPE, class ARGS_01,
943 class ARGS_02,
944 class ARGS_03,
945 class ARGS_04,
946 class ARGS_05,
947 class ARGS_06,
948 class ARGS_07,
949 class ARGS_08,
950 class ARGS_09,
951 class ARGS_10,
952 class ARGS_11>
953 static ManagedPtr<ELEMENT_TYPE>
955 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
956 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
957 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
958 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
959 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
960 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
961 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
962 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
963 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
964 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
965 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11);
966#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 11
967
968#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 12
969 template <class ELEMENT_TYPE, class ARGS_01,
970 class ARGS_02,
971 class ARGS_03,
972 class ARGS_04,
973 class ARGS_05,
974 class ARGS_06,
975 class ARGS_07,
976 class ARGS_08,
977 class ARGS_09,
978 class ARGS_10,
979 class ARGS_11,
980 class ARGS_12>
981 static ManagedPtr<ELEMENT_TYPE>
983 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
984 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
985 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
986 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
987 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
988 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
989 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
990 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
991 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
992 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
993 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11,
994 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) args_12);
995#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 12
996
997#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 13
998 template <class ELEMENT_TYPE, class ARGS_01,
999 class ARGS_02,
1000 class ARGS_03,
1001 class ARGS_04,
1002 class ARGS_05,
1003 class ARGS_06,
1004 class ARGS_07,
1005 class ARGS_08,
1006 class ARGS_09,
1007 class ARGS_10,
1008 class ARGS_11,
1009 class ARGS_12,
1010 class ARGS_13>
1011 static ManagedPtr<ELEMENT_TYPE>
1013 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1014 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1015 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1016 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1017 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1018 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1019 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1020 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
1021 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
1022 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
1023 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11,
1024 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) args_12,
1025 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_13) args_13);
1026#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 13
1027
1028#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 14
1029 template <class ELEMENT_TYPE, class ARGS_01,
1030 class ARGS_02,
1031 class ARGS_03,
1032 class ARGS_04,
1033 class ARGS_05,
1034 class ARGS_06,
1035 class ARGS_07,
1036 class ARGS_08,
1037 class ARGS_09,
1038 class ARGS_10,
1039 class ARGS_11,
1040 class ARGS_12,
1041 class ARGS_13,
1042 class ARGS_14>
1043 static ManagedPtr<ELEMENT_TYPE>
1045 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1046 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1047 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1048 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1049 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1050 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1051 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1052 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
1053 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
1054 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
1055 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11,
1056 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) args_12,
1057 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_13) args_13,
1058 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_14) args_14);
1059#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 14
1060
1061#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 0
1062 template <class ELEMENT_TYPE, class ALLOCATOR>
1064 ManagedPtr<ELEMENT_TYPE> >::type
1065 allocateManaged(const ALLOCATOR& allocator);
1066#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 0
1067
1068#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 1
1069 template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01>
1071 ManagedPtr<ELEMENT_TYPE> >::type
1072 allocateManaged(const ALLOCATOR& allocator,
1073 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01);
1074#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 1
1075
1076#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 2
1077 template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
1078 class ARGS_02>
1080 ManagedPtr<ELEMENT_TYPE> >::type
1081 allocateManaged(const ALLOCATOR& allocator,
1082 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1083 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02);
1084#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 2
1085
1086#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 3
1087 template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
1088 class ARGS_02,
1089 class ARGS_03>
1091 ManagedPtr<ELEMENT_TYPE> >::type
1092 allocateManaged(const ALLOCATOR& allocator,
1093 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1094 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1095 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03);
1096#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 3
1097
1098#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 4
1099 template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
1100 class ARGS_02,
1101 class ARGS_03,
1102 class ARGS_04>
1104 ManagedPtr<ELEMENT_TYPE> >::type
1105 allocateManaged(const ALLOCATOR& allocator,
1106 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1107 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1108 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1109 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04);
1110#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 4
1111
1112#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 5
1113 template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
1114 class ARGS_02,
1115 class ARGS_03,
1116 class ARGS_04,
1117 class ARGS_05>
1119 ManagedPtr<ELEMENT_TYPE> >::type
1120 allocateManaged(const ALLOCATOR& allocator,
1121 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1122 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1123 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1124 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1125 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05);
1126#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 5
1127
1128#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 6
1129 template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
1130 class ARGS_02,
1131 class ARGS_03,
1132 class ARGS_04,
1133 class ARGS_05,
1134 class ARGS_06>
1136 ManagedPtr<ELEMENT_TYPE> >::type
1137 allocateManaged(const ALLOCATOR& allocator,
1138 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1139 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1140 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1141 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1142 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1143 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06);
1144#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 6
1145
1146#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 7
1147 template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
1148 class ARGS_02,
1149 class ARGS_03,
1150 class ARGS_04,
1151 class ARGS_05,
1152 class ARGS_06,
1153 class ARGS_07>
1155 ManagedPtr<ELEMENT_TYPE> >::type
1156 allocateManaged(const ALLOCATOR& allocator,
1157 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1158 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1159 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1160 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1161 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1162 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1163 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07);
1164#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 7
1165
1166#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 8
1167 template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
1168 class ARGS_02,
1169 class ARGS_03,
1170 class ARGS_04,
1171 class ARGS_05,
1172 class ARGS_06,
1173 class ARGS_07,
1174 class ARGS_08>
1176 ManagedPtr<ELEMENT_TYPE> >::type
1177 allocateManaged(const ALLOCATOR& allocator,
1178 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1179 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1180 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1181 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1182 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1183 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1184 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1185 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08);
1186#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 8
1187
1188#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 9
1189 template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
1190 class ARGS_02,
1191 class ARGS_03,
1192 class ARGS_04,
1193 class ARGS_05,
1194 class ARGS_06,
1195 class ARGS_07,
1196 class ARGS_08,
1197 class ARGS_09>
1199 ManagedPtr<ELEMENT_TYPE> >::type
1200 allocateManaged(const ALLOCATOR& allocator,
1201 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1202 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1203 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1204 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1205 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1206 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1207 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1208 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
1209 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09);
1210#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 9
1211
1212#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 10
1213 template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
1214 class ARGS_02,
1215 class ARGS_03,
1216 class ARGS_04,
1217 class ARGS_05,
1218 class ARGS_06,
1219 class ARGS_07,
1220 class ARGS_08,
1221 class ARGS_09,
1222 class ARGS_10>
1224 ManagedPtr<ELEMENT_TYPE> >::type
1225 allocateManaged(const ALLOCATOR& allocator,
1226 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1227 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1228 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1229 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1230 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1231 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1232 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1233 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
1234 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
1235 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10);
1236#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 10
1237
1238#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 11
1239 template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
1240 class ARGS_02,
1241 class ARGS_03,
1242 class ARGS_04,
1243 class ARGS_05,
1244 class ARGS_06,
1245 class ARGS_07,
1246 class ARGS_08,
1247 class ARGS_09,
1248 class ARGS_10,
1249 class ARGS_11>
1251 ManagedPtr<ELEMENT_TYPE> >::type
1252 allocateManaged(const ALLOCATOR& allocator,
1253 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1254 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1255 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1256 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1257 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1258 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1259 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1260 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
1261 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
1262 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
1263 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11);
1264#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 11
1265
1266#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 12
1267 template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
1268 class ARGS_02,
1269 class ARGS_03,
1270 class ARGS_04,
1271 class ARGS_05,
1272 class ARGS_06,
1273 class ARGS_07,
1274 class ARGS_08,
1275 class ARGS_09,
1276 class ARGS_10,
1277 class ARGS_11,
1278 class ARGS_12>
1280 ManagedPtr<ELEMENT_TYPE> >::type
1281 allocateManaged(const ALLOCATOR& allocator,
1282 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1283 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1284 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1285 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1286 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1287 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1288 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1289 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
1290 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
1291 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
1292 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11,
1293 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) args_12);
1294#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 12
1295
1296#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 13
1297 template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
1298 class ARGS_02,
1299 class ARGS_03,
1300 class ARGS_04,
1301 class ARGS_05,
1302 class ARGS_06,
1303 class ARGS_07,
1304 class ARGS_08,
1305 class ARGS_09,
1306 class ARGS_10,
1307 class ARGS_11,
1308 class ARGS_12,
1309 class ARGS_13>
1311 ManagedPtr<ELEMENT_TYPE> >::type
1312 allocateManaged(const ALLOCATOR& allocator,
1313 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1314 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1315 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1316 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1317 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1318 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1319 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1320 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
1321 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
1322 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
1323 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11,
1324 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) args_12,
1325 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_13) args_13);
1326#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 13
1327
1328#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 14
1329 template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
1330 class ARGS_02,
1331 class ARGS_03,
1332 class ARGS_04,
1333 class ARGS_05,
1334 class ARGS_06,
1335 class ARGS_07,
1336 class ARGS_08,
1337 class ARGS_09,
1338 class ARGS_10,
1339 class ARGS_11,
1340 class ARGS_12,
1341 class ARGS_13,
1342 class ARGS_14>
1344 ManagedPtr<ELEMENT_TYPE> >::type
1345 allocateManaged(const ALLOCATOR& allocator,
1346 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1347 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1348 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1349 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1350 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1351 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1352 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1353 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
1354 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
1355 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
1356 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11,
1357 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) args_12,
1358 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_13) args_13,
1359 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_14) args_14);
1360#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 14
1361
1362
1363#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 0
1364 template <class ELEMENT_TYPE>
1365 static ManagedPtr<ELEMENT_TYPE> makeManaged(
1366 );
1367#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 0
1368
1369#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 1
1370 template <class ELEMENT_TYPE, class ARGS_01>
1371 static ManagedPtr<ELEMENT_TYPE> makeManaged(
1372 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01);
1373#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 1
1374
1375#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 2
1376 template <class ELEMENT_TYPE, class ARGS_01,
1377 class ARGS_02>
1378 static ManagedPtr<ELEMENT_TYPE> makeManaged(
1379 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1380 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02);
1381#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 2
1382
1383#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 3
1384 template <class ELEMENT_TYPE, class ARGS_01,
1385 class ARGS_02,
1386 class ARGS_03>
1387 static ManagedPtr<ELEMENT_TYPE> makeManaged(
1388 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1389 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1390 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03);
1391#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 3
1392
1393#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 4
1394 template <class ELEMENT_TYPE, class ARGS_01,
1395 class ARGS_02,
1396 class ARGS_03,
1397 class ARGS_04>
1398 static ManagedPtr<ELEMENT_TYPE> makeManaged(
1399 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1400 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1401 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1402 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04);
1403#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 4
1404
1405#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 5
1406 template <class ELEMENT_TYPE, class ARGS_01,
1407 class ARGS_02,
1408 class ARGS_03,
1409 class ARGS_04,
1410 class ARGS_05>
1411 static ManagedPtr<ELEMENT_TYPE> makeManaged(
1412 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1413 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1414 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1415 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1416 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05);
1417#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 5
1418
1419#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 6
1420 template <class ELEMENT_TYPE, class ARGS_01,
1421 class ARGS_02,
1422 class ARGS_03,
1423 class ARGS_04,
1424 class ARGS_05,
1425 class ARGS_06>
1426 static ManagedPtr<ELEMENT_TYPE> makeManaged(
1427 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1428 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1429 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1430 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1431 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1432 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06);
1433#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 6
1434
1435#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 7
1436 template <class ELEMENT_TYPE, class ARGS_01,
1437 class ARGS_02,
1438 class ARGS_03,
1439 class ARGS_04,
1440 class ARGS_05,
1441 class ARGS_06,
1442 class ARGS_07>
1443 static ManagedPtr<ELEMENT_TYPE> makeManaged(
1444 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1445 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1446 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1447 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1448 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1449 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1450 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07);
1451#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 7
1452
1453#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 8
1454 template <class ELEMENT_TYPE, class ARGS_01,
1455 class ARGS_02,
1456 class ARGS_03,
1457 class ARGS_04,
1458 class ARGS_05,
1459 class ARGS_06,
1460 class ARGS_07,
1461 class ARGS_08>
1462 static ManagedPtr<ELEMENT_TYPE> makeManaged(
1463 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1464 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1465 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1466 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1467 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1468 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1469 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1470 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08);
1471#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 8
1472
1473#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 9
1474 template <class ELEMENT_TYPE, class ARGS_01,
1475 class ARGS_02,
1476 class ARGS_03,
1477 class ARGS_04,
1478 class ARGS_05,
1479 class ARGS_06,
1480 class ARGS_07,
1481 class ARGS_08,
1482 class ARGS_09>
1483 static ManagedPtr<ELEMENT_TYPE> makeManaged(
1484 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1485 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1486 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1487 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1488 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1489 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1490 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1491 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
1492 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09);
1493#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 9
1494
1495#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 10
1496 template <class ELEMENT_TYPE, class ARGS_01,
1497 class ARGS_02,
1498 class ARGS_03,
1499 class ARGS_04,
1500 class ARGS_05,
1501 class ARGS_06,
1502 class ARGS_07,
1503 class ARGS_08,
1504 class ARGS_09,
1505 class ARGS_10>
1506 static ManagedPtr<ELEMENT_TYPE> makeManaged(
1507 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1508 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1509 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1510 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1511 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1512 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1513 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1514 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
1515 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
1516 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10);
1517#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 10
1518
1519#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 11
1520 template <class ELEMENT_TYPE, class ARGS_01,
1521 class ARGS_02,
1522 class ARGS_03,
1523 class ARGS_04,
1524 class ARGS_05,
1525 class ARGS_06,
1526 class ARGS_07,
1527 class ARGS_08,
1528 class ARGS_09,
1529 class ARGS_10,
1530 class ARGS_11>
1531 static ManagedPtr<ELEMENT_TYPE> makeManaged(
1532 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1533 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1534 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1535 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1536 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1537 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1538 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1539 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
1540 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
1541 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
1542 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11);
1543#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 11
1544
1545#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 12
1546 template <class ELEMENT_TYPE, class ARGS_01,
1547 class ARGS_02,
1548 class ARGS_03,
1549 class ARGS_04,
1550 class ARGS_05,
1551 class ARGS_06,
1552 class ARGS_07,
1553 class ARGS_08,
1554 class ARGS_09,
1555 class ARGS_10,
1556 class ARGS_11,
1557 class ARGS_12>
1558 static ManagedPtr<ELEMENT_TYPE> makeManaged(
1559 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1560 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1561 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1562 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1563 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1564 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1565 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1566 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
1567 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
1568 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
1569 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11,
1570 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) args_12);
1571#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 12
1572
1573#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 13
1574 template <class ELEMENT_TYPE, class ARGS_01,
1575 class ARGS_02,
1576 class ARGS_03,
1577 class ARGS_04,
1578 class ARGS_05,
1579 class ARGS_06,
1580 class ARGS_07,
1581 class ARGS_08,
1582 class ARGS_09,
1583 class ARGS_10,
1584 class ARGS_11,
1585 class ARGS_12,
1586 class ARGS_13>
1587 static ManagedPtr<ELEMENT_TYPE> makeManaged(
1588 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1589 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1590 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1591 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1592 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1593 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1594 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1595 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
1596 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
1597 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
1598 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11,
1599 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) args_12,
1600 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_13) args_13);
1601#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 13
1602
1603#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 14
1604 template <class ELEMENT_TYPE, class ARGS_01,
1605 class ARGS_02,
1606 class ARGS_03,
1607 class ARGS_04,
1608 class ARGS_05,
1609 class ARGS_06,
1610 class ARGS_07,
1611 class ARGS_08,
1612 class ARGS_09,
1613 class ARGS_10,
1614 class ARGS_11,
1615 class ARGS_12,
1616 class ARGS_13,
1617 class ARGS_14>
1618 static ManagedPtr<ELEMENT_TYPE> makeManaged(
1619 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1620 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1621 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1622 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1623 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1624 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1625 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1626 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
1627 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
1628 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
1629 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11,
1630 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) args_12,
1631 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_13) args_13,
1632 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_14) args_14);
1633#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 14
1634
1635#else
1636// The generated code below is a workaround for the absence of perfect
1637// forwarding in some compilers.
1638
1639 template <class ELEMENT_TYPE, class... ARGS>
1640 static ManagedPtr<ELEMENT_TYPE>
1642 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)... args);
1643 template <class ELEMENT_TYPE, class ALLOCATOR, class... ARGS>
1645 ManagedPtr<ELEMENT_TYPE> >::type
1646 allocateManaged(const ALLOCATOR& allocator,
1647 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)... args);
1648
1649 template <class ELEMENT_TYPE, class... ARGS>
1650 static ManagedPtr<ELEMENT_TYPE> makeManaged(
1651 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)... args);
1652
1653// }}} END GENERATED CODE
1654#endif
1655};
1656
1657 // ===========================
1658 // struct ManagedPtrNilDeleter
1659 // ===========================
1660
1661/// [**DEPRECATED**]: Use `ManagedPtrUtil::noOpDeleter` instead.
1662///
1663/// This utility class provides a general no-op deleter, which is useful
1664/// when creating managed pointers to stack-allocated objects. Note that
1665/// the non-template class `ManagedPtrUtil` should be used in preference to
1666/// this deprecated class, avoiding both template bloat and undefined
1667/// behavior.
1668template <class TARGET_TYPE>
1669struct ManagedPtrNilDeleter {
1670
1671 // CLASS METHODS
1672
1673 /// Deleter function that does nothing.
1674 static void deleter(void *, void *);
1675};
1676
1677 // ===========================================
1678 // private class ManagedPtr_FactoryDeleterType
1679 // ===========================================
1680
1681/// This metafunction class-template provides a means to compute the
1682/// preferred deleter function for a factory class for those methods of
1683/// `ManagedPtr` that supply only a factory, and no additional deleter
1684/// function. The intent is to use a common deleter function for all
1685/// allocators that implement the `bslma::Allocator` protocol, rather than
1686/// create a special deleter function based on the complete type of each
1687/// allocator, each doing the same thing (invoking the virtual function
1688/// `deleteObject`).
1689template <class TARGET_TYPE, class FACTORY_TYPE>
1690struct ManagedPtr_FactoryDeleterType
1692 bsl::is_convertible<FACTORY_TYPE *, Allocator *>::value,
1693 ManagedPtr_FactoryDeleter<TARGET_TYPE, Allocator>,
1694 ManagedPtr_FactoryDeleter<TARGET_TYPE, FACTORY_TYPE> > {
1695};
1696
1697 // ========================================
1698 // private struct ManagedPtr_DefaultDeleter
1699 // ========================================
1700
1701/// This `struct` provides a function-like managed pointer deleter that
1702/// invokes `delete` with the passed pointer.
1703template <class MANAGED_TYPE>
1704struct ManagedPtr_DefaultDeleter {
1705
1706 // CLASS METHODS
1707
1708 /// Cast the specified `ptr` to (template parameter) type
1709 /// `MANAGED_TYPE *`, and then call `delete` with the cast pointer.
1710 static void deleter(void *ptr, void *);
1711};
1712
1713
1714// ============================================================================
1715// INLINE DEFINITIONS
1716// ============================================================================
1717
1718 // ---------------------------------
1719 // private struct ManagedPtr_ImpUtil
1720 // ---------------------------------
1721
1722// CLASS METHODS
1723template <class TYPE>
1724inline
1726{
1727 return static_cast<void *>(
1728 const_cast<typename bsl::remove_cv<TYPE>::type *>(address));
1729}
1730
1731template <class TYPE>
1732inline
1733TYPE *ManagedPtr_ImpUtil::unqualify(const volatile TYPE *address)
1735{
1736 return const_cast<TYPE *>(address);
1737}
1738
1739 // ----------------------------
1740 // private class ManagedPtr_Ref
1741 // ----------------------------
1742
1743// CREATORS
1744template <class TARGET_TYPE>
1745inline
1746ManagedPtr_Ref<TARGET_TYPE>::ManagedPtr_Ref(ManagedPtr_Members *base,
1747 TARGET_TYPE *target)
1748: d_base_p(base)
1749, d_cast_p(target)
1750{
1751 BSLS_ASSERT_SAFE(0 != base);
1752}
1753
1754template <class TARGET_TYPE>
1755inline
1756ManagedPtr_Ref<TARGET_TYPE>::~ManagedPtr_Ref()
1757{
1758 BSLS_ASSERT_SAFE(0 != d_base_p);
1759}
1760
1761// ACCESSORS
1762template <class TARGET_TYPE>
1763inline
1764ManagedPtr_Members *ManagedPtr_Ref<TARGET_TYPE>::base() const
1765{
1766 return d_base_p;
1767}
1768
1769template <class TARGET_TYPE>
1770inline
1771TARGET_TYPE *ManagedPtr_Ref<TARGET_TYPE>::target() const
1772{
1773 return d_cast_p;
1774}
1775
1776 // ----------------
1777 // class ManagedPtr
1778 // ----------------
1779
1780template <class TARGET_TYPE>
1781class ManagedPtr<volatile TARGET_TYPE>;
1782 // This specialization is declared but not defined, in order to provide an
1783 // early compile-fail check to catch misuse of managed pointer to
1784 // 'volatile' types, which is explicitly called out as not supported in the
1785 // primary class template contract.
1786
1787template <class TARGET_TYPE>
1788class ManagedPtr<TARGET_TYPE&>;
1789 // This specialization is declared but not defined, in order to provide an
1790 // early compile-fail check to catch misuse of managed pointer to reference
1791 // types, which is explicitly called out as not supported in the primary
1792 // class template contract.
1793
1794#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
1795template <class TARGET_TYPE>
1796class ManagedPtr<TARGET_TYPE&&>;
1797 // This specialization is declared but not defined, in order to provide an
1798 // early compile-fail check to catch misuse of managed pointer to reference
1799 // types, which is explicitly called out as not supported in the primary
1800 // class template contract.
1801#endif
1802
1803// PRIVATE CLASS METHODS
1804template <class TARGET_TYPE>
1805inline
1806void *ManagedPtr<TARGET_TYPE>::stripBasePointerType(TARGET_TYPE *ptr)
1807{
1808 return const_cast<void *>(static_cast<const void *>(ptr));
1809}
1810
1811template <class TARGET_TYPE>
1812template <class MANAGED_TYPE>
1813inline
1814void *
1815ManagedPtr<TARGET_TYPE>::stripCompletePointerType(MANAGED_TYPE *ptr)
1816{
1817 return const_cast<void *>(static_cast<const void *>(ptr));
1818}
1819
1820// PRIVATE MANIPULATORS
1821template <class TARGET_TYPE>
1822template <class MANAGED_TYPE>
1823inline
1824void ManagedPtr<TARGET_TYPE>::loadImp(MANAGED_TYPE *ptr,
1825 void *cookie,
1826 DeleterFunc deleter)
1827{
1829 BSLS_ASSERT_SAFE(0 != deleter || 0 == ptr);
1830
1831 d_members.runDeleter();
1832 d_members.set(stripCompletePointerType(ptr), cookie, deleter);
1833 d_members.setAliasPtr(stripBasePointerType(ptr));
1834}
1835
1836// CREATORS
1837template <class TARGET_TYPE>
1838inline
1839ManagedPtr<TARGET_TYPE>::ManagedPtr()
1840: d_members()
1841{
1842}
1843
1844template <class TARGET_TYPE>
1845template <class MANAGED_TYPE>
1846inline
1847ManagedPtr<TARGET_TYPE>::ManagedPtr(MANAGED_TYPE *ptr)
1848: d_members(stripCompletePointerType(ptr),
1849 0,
1850 &ManagedPtr_DefaultDeleter<MANAGED_TYPE>::deleter,
1851 stripBasePointerType(ptr))
1852{
1854}
1855
1856template <class TARGET_TYPE>
1857inline
1858ManagedPtr<TARGET_TYPE>::ManagedPtr(ManagedPtr_Ref<TARGET_TYPE> ref)
1860: d_members(*ref.base())
1861{
1862 d_members.setAliasPtr(stripBasePointerType(ref.target()));
1863}
1864
1865template <class TARGET_TYPE>
1866inline
1867ManagedPtr<TARGET_TYPE>::ManagedPtr(ManagedPtr& original) BSLS_KEYWORD_NOEXCEPT
1868: d_members(original.d_members)
1869{
1870}
1871
1872template <class TARGET_TYPE>
1873inline
1874ManagedPtr<TARGET_TYPE>::ManagedPtr(bslmf::MovableRef<ManagedPtr> original)
1876: d_members(MoveUtil::access(original).d_members)
1877{
1878}
1879
1880#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
1881 template <class TARGET_TYPE>
1882 template <class BDE_OTHER_TYPE>
1883 inline
1884 ManagedPtr<TARGET_TYPE>::ManagedPtr(
1885 ManagedPtr<BDE_OTHER_TYPE> &&original,
1886 typename bsl::enable_if<bsl::is_convertible<BDE_OTHER_TYPE *,
1887 TARGET_TYPE *>::value,
1888 ManagedPtr_TraitConstraint>::type)
1890 : d_members(original.d_members)
1891#elif defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
1892 // sun compiler version 12.3 and earlier
1893 template <class TARGET_TYPE>
1894 template <class BDE_OTHER_TYPE>
1895 inline
1896 ManagedPtr<TARGET_TYPE>::ManagedPtr(
1897 bslmf::MovableRef<ManagedPtr<BDE_OTHER_TYPE> > original)
1899 : d_members(MoveUtil::access(original).d_members)
1900#else // c++03 except old (version <= 12.3) sun compilers
1901 template <class TARGET_TYPE>
1902 template <class BDE_OTHER_TYPE>
1903 inline
1904 ManagedPtr<TARGET_TYPE>::ManagedPtr(
1905 bslmf::MovableRef<ManagedPtr<BDE_OTHER_TYPE> > original,
1906 typename bsl::enable_if<bsl::is_convertible<BDE_OTHER_TYPE *,
1907 TARGET_TYPE *>::value,
1908 ManagedPtr_TraitConstraint>::type)
1910 : d_members(MoveUtil::access(original).d_members)
1911#endif
1912{
1913 // This constructor cannot be constrained using a type trait on old Sun
1914 // compilers (version <= 12.3), so we need the check here.
1915 #if defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
1916 BSLMF_ASSERT((bsl::is_convertible<BDE_OTHER_TYPE *,
1917 TARGET_TYPE *>::value));
1918 #endif
1919
1920 // To deal with the possibility of multiple inheritance, we need to
1921 // "correct" the target pointer.
1922 d_members.setAliasPtr(
1923 stripBasePointerType(
1924 static_cast<TARGET_TYPE *>(
1925 static_cast<BDE_OTHER_TYPE *>(
1926 d_members.pointer()))));
1927}
1928
1929
1930template <class TARGET_TYPE>
1931template <class ALIASED_TYPE>
1932inline
1933ManagedPtr<TARGET_TYPE>::ManagedPtr(ManagedPtr<ALIASED_TYPE>& alias,
1934 TARGET_TYPE *ptr)
1935: d_members()
1936{
1937 BSLS_ASSERT_SAFE(0 != alias.get() || 0 == ptr);
1938
1939 if (0 != ptr) {
1940 d_members.move(&alias.d_members);
1941 d_members.setAliasPtr(stripBasePointerType(ptr));
1942 }
1943}
1944
1945template <class TARGET_TYPE>
1946template <class ALIASED_TYPE>
1947inline
1948ManagedPtr<TARGET_TYPE>::ManagedPtr(
1949#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
1950 ManagedPtr<ALIASED_TYPE>&& alias,
1951#else
1952 bslmf::MovableRef<ManagedPtr<ALIASED_TYPE> > alias,
1953#endif
1954 TARGET_TYPE *ptr)
1955: d_members()
1956{
1957 ManagedPtr<ALIASED_TYPE>& lvalue = alias;
1958
1959 BSLS_ASSERT_SAFE(0 != lvalue.get() || 0 == ptr);
1960
1961 if (0 != ptr) {
1962 d_members.move(&lvalue.d_members);
1963 d_members.setAliasPtr(stripBasePointerType(ptr));
1964 }
1965}
1966
1967template <class TARGET_TYPE>
1968template <class MANAGED_TYPE, class FACTORY_TYPE>
1969inline
1970ManagedPtr<TARGET_TYPE>::ManagedPtr(MANAGED_TYPE *ptr, FACTORY_TYPE *factory)
1971: d_members(stripCompletePointerType(ptr),
1972 factory,
1973 &ManagedPtr_FactoryDeleterType<MANAGED_TYPE,
1974 FACTORY_TYPE>::type::deleter,
1975 stripBasePointerType(ptr))
1976{
1978 BSLS_ASSERT_SAFE(0 != factory || 0 == ptr);
1979}
1980
1981template <class TARGET_TYPE>
1982inline
1983ManagedPtr<TARGET_TYPE>::ManagedPtr(bsl::nullptr_t, bsl::nullptr_t)
1984: d_members()
1985{
1986}
1987
1988template <class TARGET_TYPE>
1989template <class FACTORY_TYPE>
1990inline
1991ManagedPtr<TARGET_TYPE>::ManagedPtr(bsl::nullptr_t, FACTORY_TYPE *)
1992: d_members()
1993{
1994}
1995
1996template <class TARGET_TYPE>
1997inline
1998ManagedPtr<TARGET_TYPE>::ManagedPtr(TARGET_TYPE *ptr,
1999 void *cookie,
2000 DeleterFunc deleter)
2001: d_members(stripBasePointerType(ptr), cookie, deleter)
2002{
2003 BSLS_ASSERT_SAFE(0 != deleter || 0 == ptr);
2004}
2005
2006template <class TARGET_TYPE>
2007template <class MANAGED_TYPE>
2008inline
2009ManagedPtr<TARGET_TYPE>::ManagedPtr(MANAGED_TYPE *ptr,
2010 void *cookie,
2011 DeleterFunc deleter)
2012: d_members(stripCompletePointerType(ptr),
2013 cookie,
2014 deleter,
2015 stripBasePointerType(ptr))
2016{
2018
2019 BSLS_ASSERT_SAFE(0 != deleter || 0 == ptr);
2020}
2021
2022#ifndef BDE_OMIT_INTERNAL_DEPRECATED
2023template <class TARGET_TYPE>
2024template <class MANAGED_TYPE, class MANAGED_BASE>
2025inline
2026ManagedPtr<TARGET_TYPE>::ManagedPtr(
2027 MANAGED_TYPE *ptr,
2028 void *cookie,
2029 void (*deleter)(MANAGED_BASE *, void *))
2030: d_members(stripCompletePointerType(ptr),
2031 cookie,
2032 reinterpret_cast<DeleterFunc>(deleter),
2033 stripBasePointerType(ptr))
2034{
2036 BSLMF_ASSERT((bsl::is_convertible<MANAGED_TYPE *,
2037 const MANAGED_BASE *>::value));
2038
2039 BSLS_ASSERT_SAFE(0 != deleter || 0 == ptr);
2040}
2041
2042template <class TARGET_TYPE>
2043template <class MANAGED_TYPE,
2044 class MANAGED_BASE,
2045 class COOKIE_TYPE,
2046 class COOKIE_BASE>
2047inline
2048ManagedPtr<TARGET_TYPE>::ManagedPtr(
2049 MANAGED_TYPE *ptr,
2050 COOKIE_TYPE *cookie,
2051 void (*deleter)(MANAGED_BASE *, COOKIE_BASE *))
2052: d_members(stripCompletePointerType(ptr),
2053 static_cast<COOKIE_BASE *>(cookie),
2054 reinterpret_cast<DeleterFunc>(deleter),
2055 stripBasePointerType(ptr))
2056{
2058 BSLMF_ASSERT((bsl::is_convertible<MANAGED_TYPE *,
2059 const MANAGED_BASE *>::value));
2061
2062 // Note that the undefined behavior embodied in the @ref reinterpret_cast
2063 // above could be removed by inserting an additional forwarding function
2064 // truly of type 'DeleterFunc' which @ref reinterpret_cast s each pointer
2065 // argument as part of its forwarding behavior. We choose not to do this
2066 // on the grounds of simple efficiency, and there is currently no known
2067 // supported compiler that we use where this does not work as desired.
2068
2069 BSLS_ASSERT_SAFE(0 != deleter || 0 == ptr);
2070}
2071#endif // BDE_OMIT_INTERNAL_DEPRECATED
2072
2073template <class TARGET_TYPE>
2074inline
2075ManagedPtr<TARGET_TYPE>::~ManagedPtr()
2076{
2077 d_members.runDeleter();
2078}
2079
2080// MANIPULATORS
2081template <class TARGET_TYPE>
2082inline
2083ManagedPtr<TARGET_TYPE>&
2084ManagedPtr<TARGET_TYPE>::operator=(ManagedPtr& rhs) BSLS_KEYWORD_NOEXCEPT
2085{
2086 d_members.moveAssign(&rhs.d_members);
2087 return *this;
2088}
2089
2090template <class TARGET_TYPE>
2091inline
2092ManagedPtr<TARGET_TYPE>&
2093ManagedPtr<TARGET_TYPE>::operator=(bslmf::MovableRef<ManagedPtr> rhs)
2095{
2096 ManagedPtr& lvalue = rhs;
2097 d_members.moveAssign(&lvalue.d_members);
2098 return *this;
2099}
2100
2101#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
2102 template <class TARGET_TYPE>
2103 template <class BDE_OTHER_TYPE>
2104 inline
2105 typename bsl::enable_if<
2107 ManagedPtr<TARGET_TYPE> >::type&
2108 ManagedPtr<TARGET_TYPE>::operator =(
2109 ManagedPtr<BDE_OTHER_TYPE>&& rhs) BSLS_KEYWORD_NOEXCEPT
2110#elif defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
2111 // sun compiler version 12.3 and earlier
2112 template <class TARGET_TYPE>
2113 template <class BDE_OTHER_TYPE>
2114 inline
2115 ManagedPtr<TARGET_TYPE>&
2116 ManagedPtr<TARGET_TYPE>::operator =(
2117 bslmf::MovableRef<ManagedPtr<BDE_OTHER_TYPE> > rhs)
2119#else // c++03 except old (version <= 12.3) sun compilers
2120 template <class TARGET_TYPE>
2121 template <class BDE_OTHER_TYPE>
2122 inline
2123 typename bsl::enable_if<
2125 ManagedPtr<TARGET_TYPE> >::type&
2126 ManagedPtr<TARGET_TYPE>::operator =(
2127 bslmf::MovableRef<ManagedPtr<BDE_OTHER_TYPE> > rhs)
2129#endif
2130{
2131 // This operator cannot be constrained using a type trait on Sun, so we
2132 // need the check here.
2133 #if defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
2134 BSLMF_ASSERT((bsl::is_convertible<BDE_OTHER_TYPE *,
2135 TARGET_TYPE *>::value));
2136 #endif
2137
2138 ManagedPtr<BDE_OTHER_TYPE>& lvalue = rhs;
2139 d_members.moveAssign(&lvalue.d_members);
2140
2141 // To deal with the possibility of multiple inheritance, we need to
2142 // "correct" the target pointer.
2143 d_members.setAliasPtr(
2144 stripBasePointerType(
2145 static_cast<TARGET_TYPE *>(
2146 static_cast<BDE_OTHER_TYPE *>(
2147 d_members.pointer()))));
2148
2149 return *this;
2150}
2151
2152template <class TARGET_TYPE>
2153inline
2154ManagedPtr<TARGET_TYPE>&
2155ManagedPtr<TARGET_TYPE>::operator=(ManagedPtr_Ref<TARGET_TYPE> ref)
2157{
2158 d_members.moveAssign(ref.base());
2159 d_members.setAliasPtr(stripBasePointerType(ref.target()));
2160 return *this;
2161}
2162
2163template <class TARGET_TYPE>
2164inline
2165ManagedPtr<TARGET_TYPE>&
2166ManagedPtr<TARGET_TYPE>::operator=(bsl::nullptr_t)
2167{
2168 this->reset();
2169 return *this;
2170}
2171
2172template <class TARGET_TYPE>
2173template <class REFERENCED_TYPE>
2174inline
2175ManagedPtr<TARGET_TYPE>::operator ManagedPtr_Ref<REFERENCED_TYPE>()
2176{
2177 BSLMF_ASSERT((bsl::is_convertible<TARGET_TYPE *,
2178 REFERENCED_TYPE *>::value));
2179
2180 return ManagedPtr_Ref<REFERENCED_TYPE>(&d_members,
2181 static_cast<REFERENCED_TYPE *>(
2182 static_cast<TARGET_TYPE *>(d_members.pointer())));
2183}
2184
2185template <class TARGET_TYPE>
2186inline
2187void ManagedPtr<TARGET_TYPE>::clear()
2188{
2189 reset();
2190}
2191
2192template <class TARGET_TYPE>
2193template <class MANAGED_TYPE>
2194inline
2195void ManagedPtr<TARGET_TYPE>::load(MANAGED_TYPE *ptr)
2196{
2198
2199 typedef ManagedPtr_FactoryDeleter<MANAGED_TYPE, Allocator> DeleterFactory;
2200 this->loadImp(ptr,
2201 static_cast<void *>(Default::allocator()),
2202 &DeleterFactory::deleter);
2203}
2204
2205template <class TARGET_TYPE>
2206template <class MANAGED_TYPE, class FACTORY_TYPE>
2207inline
2208void ManagedPtr<TARGET_TYPE>::load(MANAGED_TYPE *ptr, FACTORY_TYPE *factory)
2209{
2211 BSLS_ASSERT_SAFE(0 != factory || 0 == ptr);
2212
2213 typedef typename
2214 ManagedPtr_FactoryDeleterType<MANAGED_TYPE, FACTORY_TYPE>::type
2215 DeleterFactory;
2216
2217 this->loadImp(ptr, static_cast<void *>(factory), &DeleterFactory::deleter);
2218}
2219
2220template <class TARGET_TYPE>
2221template <class MANAGED_TYPE>
2222inline
2223void ManagedPtr<TARGET_TYPE>::load(MANAGED_TYPE *ptr,
2224 void *cookie,
2225 DeleterFunc deleter)
2226{
2228 BSLS_ASSERT_SAFE(0 != deleter || 0 == ptr);
2229
2230 this->loadImp(ptr, cookie, deleter);
2231}
2232
2233template <class TARGET_TYPE>
2234inline
2235void ManagedPtr<TARGET_TYPE>::load(bsl::nullptr_t, void *, DeleterFunc)
2236{
2237 this->reset();
2238}
2239
2240#ifndef BDE_OMIT_INTERNAL_DEPRECATED
2241template <class TARGET_TYPE>
2242template <class MANAGED_TYPE, class COOKIE_TYPE>
2243inline
2244void ManagedPtr<TARGET_TYPE>::load(MANAGED_TYPE *ptr,
2245 COOKIE_TYPE *cookie,
2246 DeleterFunc deleter)
2247{
2249 BSLS_ASSERT_SAFE(0 != deleter || 0 == ptr);
2250
2251 this->loadImp(ptr, static_cast<void *>(cookie), deleter);
2252}
2253
2254template <class TARGET_TYPE>
2255template <class MANAGED_TYPE, class MANAGED_BASE>
2256inline
2257void ManagedPtr<TARGET_TYPE>::load(
2258 MANAGED_TYPE *ptr,
2259 void *cookie,
2260 void (*deleter)(MANAGED_BASE *, void *))
2261{
2265 BSLS_ASSERT_SAFE(0 != deleter || 0 == ptr);
2266
2267 this->loadImp(ptr, cookie, reinterpret_cast<DeleterFunc>(deleter));
2268}
2269
2270template <class TARGET_TYPE>
2271template <class MANAGED_TYPE,
2272 class MANAGED_BASE,
2273 class COOKIE_TYPE,
2274 class COOKIE_BASE>
2275inline
2276void ManagedPtr<TARGET_TYPE>::load(
2277 MANAGED_TYPE *ptr,
2278 COOKIE_TYPE *cookie,
2279 void (*deleter)(MANAGED_BASE *, COOKIE_BASE *))
2280{
2284 BSLS_ASSERT_SAFE(0 != deleter || 0 == ptr);
2285
2286 this->loadImp(ptr,
2287 static_cast<void *>(static_cast<COOKIE_BASE *>(cookie)),
2288 reinterpret_cast<DeleterFunc>(deleter));
2289}
2290#endif // BDE_OMIT_INTERNAL_DEPRECATED
2291
2292template <class TARGET_TYPE>
2293template <class ALIASED_TYPE>
2294void ManagedPtr<TARGET_TYPE>::loadAlias(ManagedPtr<ALIASED_TYPE>& alias,
2295 TARGET_TYPE *ptr)
2296{
2297 BSLS_ASSERT_SAFE(!ptr == !alias.get()); // both null or both non-null
2298
2299 if (ptr && alias.d_members.pointer()) {
2300 d_members.moveAssign(&alias.d_members);
2301 d_members.setAliasPtr(stripBasePointerType(ptr));
2302 }
2303 else {
2304 d_members.runDeleter();
2305 d_members.clear();
2306 }
2307}
2308
2309template <class TARGET_TYPE>
2310ManagedPtr_PairProxy<TARGET_TYPE, ManagedPtrDeleter>
2311ManagedPtr<TARGET_TYPE>::release()
2312{
2313 typedef ManagedPtr_PairProxy<TARGET_TYPE, ManagedPtrDeleter> ResultType;
2314
2315 TARGET_TYPE *p = get();
2316
2317 // The behavior would be undefined if 'd_members.deleter()' were called
2318 // when 'p' is null.
2319
2320 if (p) {
2321 ResultType result = { p, d_members.deleter() };
2322 d_members.clear();
2323 return result; // RETURN
2324 }
2325 ResultType result = { p, ManagedPtrDeleter() };
2326 return result;
2327}
2328
2329template <class TARGET_TYPE>
2330TARGET_TYPE *ManagedPtr<TARGET_TYPE>::release(ManagedPtrDeleter *deleter)
2331{
2332 BSLS_ASSERT_SAFE(deleter);
2333
2334 TARGET_TYPE *result = get();
2335
2336 // The behavior is undefined if 'd_members.deleter()' is called when
2337 // 'result' is null.
2338
2339 if (result) {
2340 *deleter = d_members.deleter();
2341 d_members.clear();
2342 }
2343 return result;
2344}
2345
2346template <class TARGET_TYPE>
2347inline
2348void ManagedPtr<TARGET_TYPE>::reset()
2349{
2350 d_members.runDeleter();
2351 d_members.clear();
2352}
2353
2354template <class TARGET_TYPE>
2355inline
2356void ManagedPtr<TARGET_TYPE>::swap(ManagedPtr& other)
2357{
2358 d_members.swap(other.d_members);
2359}
2360
2361// ACCESSORS
2362template <class TARGET_TYPE>
2363inline
2364#if defined(BSLS_PLATFORM_CMP_IBM) // last confirmed with xlC 12.1
2365ManagedPtr<TARGET_TYPE>::operator typename ManagedPtr::BoolType() const
2366#else
2367ManagedPtr<TARGET_TYPE>::operator BoolType() const
2368#endif
2369{
2370 return d_members.pointer()
2372 : bsls::UnspecifiedBool<ManagedPtr>::falseValue();
2373}
2374
2375template <class TARGET_TYPE>
2376inline
2378ManagedPtr<TARGET_TYPE>::operator*() const
2379{
2380 BSLS_ASSERT_SAFE(d_members.pointer());
2381
2382 return *static_cast<TARGET_TYPE *>(d_members.pointer());
2383}
2384
2385template <class TARGET_TYPE>
2386inline
2387TARGET_TYPE *ManagedPtr<TARGET_TYPE>::operator->() const
2388{
2389 return static_cast<TARGET_TYPE *>(d_members.pointer());
2390}
2391
2392template <class TARGET_TYPE>
2393inline
2394const ManagedPtrDeleter& ManagedPtr<TARGET_TYPE>::deleter() const
2395{
2396 BSLS_ASSERT_SAFE(d_members.pointer());
2397
2398 return d_members.deleter();
2399}
2400
2401template <class TARGET_TYPE>
2402inline
2403TARGET_TYPE *ManagedPtr<TARGET_TYPE>::get() const
2404{
2405 return static_cast<TARGET_TYPE *>(d_members.pointer());
2406}
2407
2408template <class TARGET_TYPE>
2409inline
2410TARGET_TYPE *ManagedPtr<TARGET_TYPE>::ptr() const
2411{
2412 return get();
2413}
2414
2415// FREE FUNCTIONS
2416template <class TARGET_TYPE>
2417inline
2418void swap(ManagedPtr<TARGET_TYPE>& a, ManagedPtr<TARGET_TYPE>& b)
2419{
2420 a.swap(b);
2421}
2422
2423 // --------------------
2424 // class ManagedPtrUtil
2425 // --------------------
2426
2427#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
2428// {{{ BEGIN GENERATED CODE
2429// Command line: sim_cpp11_features.pl bslma_managedptr.h
2430#ifndef BSLMA_MANAGEDPTR_VARIADIC_LIMIT
2431#define BSLMA_MANAGEDPTR_VARIADIC_LIMIT 14
2432#endif
2433#ifndef BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B
2434#define BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B BSLMA_MANAGEDPTR_VARIADIC_LIMIT
2435#endif
2436
2437#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 0
2438template <class ELEMENT_TYPE, class ALLOCATOR>
2439inline
2441 ManagedPtr<ELEMENT_TYPE> >::type
2442ManagedPtrUtil::allocateManaged(const ALLOCATOR& allocator)
2443{
2444 return allocateManaged<ELEMENT_TYPE>(
2445 allocator.mechanism());
2446}
2447#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 0
2448
2449#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 1
2450template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01>
2451inline
2453 ManagedPtr<ELEMENT_TYPE> >::type
2454ManagedPtrUtil::allocateManaged(const ALLOCATOR& allocator,
2455 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01)
2456{
2457 return allocateManaged<ELEMENT_TYPE>(
2458 allocator.mechanism(),
2459 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01));
2460}
2461#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 1
2462
2463#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 2
2464template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
2465 class ARGS_02>
2466inline
2468 ManagedPtr<ELEMENT_TYPE> >::type
2469ManagedPtrUtil::allocateManaged(const ALLOCATOR& allocator,
2470 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2471 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02)
2472{
2473 return allocateManaged<ELEMENT_TYPE>(
2474 allocator.mechanism(),
2475 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2476 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02));
2477}
2478#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 2
2479
2480#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 3
2481template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
2482 class ARGS_02,
2483 class ARGS_03>
2484inline
2486 ManagedPtr<ELEMENT_TYPE> >::type
2487ManagedPtrUtil::allocateManaged(const ALLOCATOR& allocator,
2488 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2489 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2490 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03)
2491{
2492 return allocateManaged<ELEMENT_TYPE>(
2493 allocator.mechanism(),
2494 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2495 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2496 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03));
2497}
2498#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 3
2499
2500#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 4
2501template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
2502 class ARGS_02,
2503 class ARGS_03,
2504 class ARGS_04>
2505inline
2507 ManagedPtr<ELEMENT_TYPE> >::type
2508ManagedPtrUtil::allocateManaged(const ALLOCATOR& allocator,
2509 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2510 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2511 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2512 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04)
2513{
2514 return allocateManaged<ELEMENT_TYPE>(
2515 allocator.mechanism(),
2516 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2517 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2518 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2519 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04));
2520}
2521#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 4
2522
2523#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 5
2524template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
2525 class ARGS_02,
2526 class ARGS_03,
2527 class ARGS_04,
2528 class ARGS_05>
2529inline
2531 ManagedPtr<ELEMENT_TYPE> >::type
2532ManagedPtrUtil::allocateManaged(const ALLOCATOR& allocator,
2533 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2534 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2535 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2536 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2537 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05)
2538{
2539 return allocateManaged<ELEMENT_TYPE>(
2540 allocator.mechanism(),
2541 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2542 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2543 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2544 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2545 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05));
2546}
2547#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 5
2548
2549#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 6
2550template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
2551 class ARGS_02,
2552 class ARGS_03,
2553 class ARGS_04,
2554 class ARGS_05,
2555 class ARGS_06>
2556inline
2558 ManagedPtr<ELEMENT_TYPE> >::type
2559ManagedPtrUtil::allocateManaged(const ALLOCATOR& allocator,
2560 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2561 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2562 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2563 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2564 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2565 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06)
2566{
2567 return allocateManaged<ELEMENT_TYPE>(
2568 allocator.mechanism(),
2569 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2570 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2571 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2572 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2573 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2574 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06));
2575}
2576#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 6
2577
2578#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 7
2579template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
2580 class ARGS_02,
2581 class ARGS_03,
2582 class ARGS_04,
2583 class ARGS_05,
2584 class ARGS_06,
2585 class ARGS_07>
2586inline
2588 ManagedPtr<ELEMENT_TYPE> >::type
2589ManagedPtrUtil::allocateManaged(const ALLOCATOR& allocator,
2590 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2591 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2592 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2593 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2594 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2595 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
2596 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07)
2597{
2598 return allocateManaged<ELEMENT_TYPE>(
2599 allocator.mechanism(),
2600 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2601 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2602 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2603 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2604 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2605 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
2606 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07));
2607}
2608#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 7
2609
2610#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 8
2611template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
2612 class ARGS_02,
2613 class ARGS_03,
2614 class ARGS_04,
2615 class ARGS_05,
2616 class ARGS_06,
2617 class ARGS_07,
2618 class ARGS_08>
2619inline
2621 ManagedPtr<ELEMENT_TYPE> >::type
2622ManagedPtrUtil::allocateManaged(const ALLOCATOR& allocator,
2623 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2624 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2625 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2626 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2627 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2628 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
2629 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
2630 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08)
2631{
2632 return allocateManaged<ELEMENT_TYPE>(
2633 allocator.mechanism(),
2634 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2635 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2636 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2637 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2638 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2639 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
2640 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
2641 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08));
2642}
2643#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 8
2644
2645#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 9
2646template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
2647 class ARGS_02,
2648 class ARGS_03,
2649 class ARGS_04,
2650 class ARGS_05,
2651 class ARGS_06,
2652 class ARGS_07,
2653 class ARGS_08,
2654 class ARGS_09>
2655inline
2657 ManagedPtr<ELEMENT_TYPE> >::type
2658ManagedPtrUtil::allocateManaged(const ALLOCATOR& allocator,
2659 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2660 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2661 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2662 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2663 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2664 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
2665 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
2666 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
2667 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09)
2668{
2669 return allocateManaged<ELEMENT_TYPE>(
2670 allocator.mechanism(),
2671 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2672 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2673 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2674 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2675 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2676 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
2677 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
2678 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
2679 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09));
2680}
2681#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 9
2682
2683#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 10
2684template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
2685 class ARGS_02,
2686 class ARGS_03,
2687 class ARGS_04,
2688 class ARGS_05,
2689 class ARGS_06,
2690 class ARGS_07,
2691 class ARGS_08,
2692 class ARGS_09,
2693 class ARGS_10>
2694inline
2696 ManagedPtr<ELEMENT_TYPE> >::type
2697ManagedPtrUtil::allocateManaged(const ALLOCATOR& allocator,
2698 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2699 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2700 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2701 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2702 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2703 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
2704 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
2705 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
2706 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
2707 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10)
2708{
2709 return allocateManaged<ELEMENT_TYPE>(
2710 allocator.mechanism(),
2711 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2712 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2713 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2714 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2715 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2716 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
2717 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
2718 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
2719 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09),
2720 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, args_10));
2721}
2722#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 10
2723
2724#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 11
2725template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
2726 class ARGS_02,
2727 class ARGS_03,
2728 class ARGS_04,
2729 class ARGS_05,
2730 class ARGS_06,
2731 class ARGS_07,
2732 class ARGS_08,
2733 class ARGS_09,
2734 class ARGS_10,
2735 class ARGS_11>
2736inline
2738 ManagedPtr<ELEMENT_TYPE> >::type
2739ManagedPtrUtil::allocateManaged(const ALLOCATOR& allocator,
2740 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2741 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2742 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2743 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2744 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2745 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
2746 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
2747 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
2748 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
2749 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
2750 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11)
2751{
2752 return allocateManaged<ELEMENT_TYPE>(
2753 allocator.mechanism(),
2754 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2755 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2756 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2757 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2758 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2759 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
2760 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
2761 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
2762 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09),
2763 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, args_10),
2764 BSLS_COMPILERFEATURES_FORWARD(ARGS_11, args_11));
2765}
2766#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 11
2767
2768#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 12
2769template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
2770 class ARGS_02,
2771 class ARGS_03,
2772 class ARGS_04,
2773 class ARGS_05,
2774 class ARGS_06,
2775 class ARGS_07,
2776 class ARGS_08,
2777 class ARGS_09,
2778 class ARGS_10,
2779 class ARGS_11,
2780 class ARGS_12>
2781inline
2783 ManagedPtr<ELEMENT_TYPE> >::type
2784ManagedPtrUtil::allocateManaged(const ALLOCATOR& allocator,
2785 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2786 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2787 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2788 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2789 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2790 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
2791 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
2792 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
2793 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
2794 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
2795 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11,
2796 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) args_12)
2797{
2798 return allocateManaged<ELEMENT_TYPE>(
2799 allocator.mechanism(),
2800 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2801 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2802 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2803 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2804 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2805 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
2806 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
2807 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
2808 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09),
2809 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, args_10),
2810 BSLS_COMPILERFEATURES_FORWARD(ARGS_11, args_11),
2811 BSLS_COMPILERFEATURES_FORWARD(ARGS_12, args_12));
2812}
2813#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 12
2814
2815#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 13
2816template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
2817 class ARGS_02,
2818 class ARGS_03,
2819 class ARGS_04,
2820 class ARGS_05,
2821 class ARGS_06,
2822 class ARGS_07,
2823 class ARGS_08,
2824 class ARGS_09,
2825 class ARGS_10,
2826 class ARGS_11,
2827 class ARGS_12,
2828 class ARGS_13>
2829inline
2831 ManagedPtr<ELEMENT_TYPE> >::type
2832ManagedPtrUtil::allocateManaged(const ALLOCATOR& allocator,
2833 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2834 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2835 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2836 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2837 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2838 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
2839 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
2840 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
2841 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
2842 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
2843 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11,
2844 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) args_12,
2845 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_13) args_13)
2846{
2847 return allocateManaged<ELEMENT_TYPE>(
2848 allocator.mechanism(),
2849 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2850 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2851 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2852 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2853 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2854 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
2855 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
2856 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
2857 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09),
2858 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, args_10),
2859 BSLS_COMPILERFEATURES_FORWARD(ARGS_11, args_11),
2860 BSLS_COMPILERFEATURES_FORWARD(ARGS_12, args_12),
2861 BSLS_COMPILERFEATURES_FORWARD(ARGS_13, args_13));
2862}
2863#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 13
2864
2865#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 14
2866template <class ELEMENT_TYPE, class ALLOCATOR, class ARGS_01,
2867 class ARGS_02,
2868 class ARGS_03,
2869 class ARGS_04,
2870 class ARGS_05,
2871 class ARGS_06,
2872 class ARGS_07,
2873 class ARGS_08,
2874 class ARGS_09,
2875 class ARGS_10,
2876 class ARGS_11,
2877 class ARGS_12,
2878 class ARGS_13,
2879 class ARGS_14>
2880inline
2882 ManagedPtr<ELEMENT_TYPE> >::type
2883ManagedPtrUtil::allocateManaged(const ALLOCATOR& allocator,
2884 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2885 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2886 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2887 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2888 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2889 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
2890 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
2891 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
2892 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
2893 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
2894 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11,
2895 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) args_12,
2896 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_13) args_13,
2897 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_14) args_14)
2898{
2899 return allocateManaged<ELEMENT_TYPE>(
2900 allocator.mechanism(),
2901 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2902 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2903 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2904 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2905 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2906 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
2907 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
2908 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
2909 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09),
2910 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, args_10),
2911 BSLS_COMPILERFEATURES_FORWARD(ARGS_11, args_11),
2912 BSLS_COMPILERFEATURES_FORWARD(ARGS_12, args_12),
2913 BSLS_COMPILERFEATURES_FORWARD(ARGS_13, args_13),
2914 BSLS_COMPILERFEATURES_FORWARD(ARGS_14, args_14));
2915}
2916#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 14
2917
2918
2919#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 0
2920template <class ELEMENT_TYPE>
2921inline
2922ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
2923 )
2924{
2926
2927 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
2928
2929 UnqualElem *objPtr =
2930 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
2931
2933 defaultAllocator, objPtr);
2934
2935 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
2936 );
2937 proctor.release();
2938
2939 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
2940}
2941#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 0
2942
2943#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 1
2944template <class ELEMENT_TYPE, class ARGS_01>
2945inline
2946ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
2947 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01)
2948{
2950
2951 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
2952
2953 UnqualElem *objPtr =
2954 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
2955
2957 defaultAllocator, objPtr);
2958
2959 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
2960 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01));
2961 proctor.release();
2962
2963 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
2964}
2965#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 1
2966
2967#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 2
2968template <class ELEMENT_TYPE, class ARGS_01,
2969 class ARGS_02>
2970inline
2971ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
2972 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2973 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02)
2974{
2976
2977 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
2978
2979 UnqualElem *objPtr =
2980 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
2981
2983 defaultAllocator, objPtr);
2984
2985 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
2986 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2987 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02));
2988 proctor.release();
2989
2990 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
2991}
2992#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 2
2993
2994#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 3
2995template <class ELEMENT_TYPE, class ARGS_01,
2996 class ARGS_02,
2997 class ARGS_03>
2998inline
2999ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3000 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3001 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
3002 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03)
3003{
3005
3006 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3007
3008 UnqualElem *objPtr =
3009 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3010
3012 defaultAllocator, objPtr);
3013
3014 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3015 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3016 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
3017 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03));
3018 proctor.release();
3019
3020 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3021}
3022#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 3
3023
3024#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 4
3025template <class ELEMENT_TYPE, class ARGS_01,
3026 class ARGS_02,
3027 class ARGS_03,
3028 class ARGS_04>
3029inline
3030ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3031 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3032 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
3033 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
3034 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04)
3035{
3037
3038 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3039
3040 UnqualElem *objPtr =
3041 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3042
3044 defaultAllocator, objPtr);
3045
3046 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3047 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3048 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
3049 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
3050 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04));
3051 proctor.release();
3052
3053 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3054}
3055#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 4
3056
3057#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 5
3058template <class ELEMENT_TYPE, class ARGS_01,
3059 class ARGS_02,
3060 class ARGS_03,
3061 class ARGS_04,
3062 class ARGS_05>
3063inline
3064ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3065 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3066 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
3067 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
3068 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
3069 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05)
3070{
3072
3073 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3074
3075 UnqualElem *objPtr =
3076 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3077
3079 defaultAllocator, objPtr);
3080
3081 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3082 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3083 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
3084 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
3085 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
3086 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05));
3087 proctor.release();
3088
3089 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3090}
3091#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 5
3092
3093#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 6
3094template <class ELEMENT_TYPE, class ARGS_01,
3095 class ARGS_02,
3096 class ARGS_03,
3097 class ARGS_04,
3098 class ARGS_05,
3099 class ARGS_06>
3100inline
3101ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3102 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3103 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
3104 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
3105 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
3106 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
3107 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06)
3108{
3110
3111 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3112
3113 UnqualElem *objPtr =
3114 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3115
3117 defaultAllocator, objPtr);
3118
3119 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3120 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3121 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
3122 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
3123 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
3124 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
3125 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06));
3126 proctor.release();
3127
3128 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3129}
3130#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 6
3131
3132#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 7
3133template <class ELEMENT_TYPE, class ARGS_01,
3134 class ARGS_02,
3135 class ARGS_03,
3136 class ARGS_04,
3137 class ARGS_05,
3138 class ARGS_06,
3139 class ARGS_07>
3140inline
3141ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3142 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3143 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
3144 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
3145 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
3146 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
3147 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
3148 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07)
3149{
3151
3152 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3153
3154 UnqualElem *objPtr =
3155 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3156
3158 defaultAllocator, objPtr);
3159
3160 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3161 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3162 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
3163 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
3164 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
3165 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
3166 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
3167 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07));
3168 proctor.release();
3169
3170 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3171}
3172#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 7
3173
3174#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 8
3175template <class ELEMENT_TYPE, class ARGS_01,
3176 class ARGS_02,
3177 class ARGS_03,
3178 class ARGS_04,
3179 class ARGS_05,
3180 class ARGS_06,
3181 class ARGS_07,
3182 class ARGS_08>
3183inline
3184ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3185 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3186 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
3187 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
3188 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
3189 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
3190 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
3191 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
3192 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08)
3193{
3195
3196 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3197
3198 UnqualElem *objPtr =
3199 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3200
3202 defaultAllocator, objPtr);
3203
3204 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3205 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3206 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
3207 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
3208 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
3209 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
3210 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
3211 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
3212 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08));
3213 proctor.release();
3214
3215 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3216}
3217#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 8
3218
3219#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 9
3220template <class ELEMENT_TYPE, class ARGS_01,
3221 class ARGS_02,
3222 class ARGS_03,
3223 class ARGS_04,
3224 class ARGS_05,
3225 class ARGS_06,
3226 class ARGS_07,
3227 class ARGS_08,
3228 class ARGS_09>
3229inline
3230ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3231 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3232 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
3233 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
3234 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
3235 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
3236 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
3237 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
3238 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
3239 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09)
3240{
3242
3243 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3244
3245 UnqualElem *objPtr =
3246 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3247
3249 defaultAllocator, objPtr);
3250
3251 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3252 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3253 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
3254 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
3255 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
3256 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
3257 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
3258 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
3259 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
3260 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09));
3261 proctor.release();
3262
3263 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3264}
3265#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 9
3266
3267#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 10
3268template <class ELEMENT_TYPE, class ARGS_01,
3269 class ARGS_02,
3270 class ARGS_03,
3271 class ARGS_04,
3272 class ARGS_05,
3273 class ARGS_06,
3274 class ARGS_07,
3275 class ARGS_08,
3276 class ARGS_09,
3277 class ARGS_10>
3278inline
3279ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3280 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3281 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
3282 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
3283 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
3284 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
3285 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
3286 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
3287 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
3288 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
3289 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10)
3290{
3292
3293 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3294
3295 UnqualElem *objPtr =
3296 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3297
3299 defaultAllocator, objPtr);
3300
3301 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3302 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3303 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
3304 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
3305 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
3306 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
3307 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
3308 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
3309 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
3310 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09),
3311 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, args_10));
3312 proctor.release();
3313
3314 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3315}
3316#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 10
3317
3318#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 11
3319template <class ELEMENT_TYPE, class ARGS_01,
3320 class ARGS_02,
3321 class ARGS_03,
3322 class ARGS_04,
3323 class ARGS_05,
3324 class ARGS_06,
3325 class ARGS_07,
3326 class ARGS_08,
3327 class ARGS_09,
3328 class ARGS_10,
3329 class ARGS_11>
3330inline
3331ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3332 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3333 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
3334 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
3335 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
3336 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
3337 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
3338 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
3339 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
3340 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
3341 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
3342 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11)
3343{
3345
3346 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3347
3348 UnqualElem *objPtr =
3349 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3350
3352 defaultAllocator, objPtr);
3353
3354 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3355 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3356 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
3357 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
3358 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
3359 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
3360 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
3361 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
3362 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
3363 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09),
3364 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, args_10),
3365 BSLS_COMPILERFEATURES_FORWARD(ARGS_11, args_11));
3366 proctor.release();
3367
3368 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3369}
3370#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 11
3371
3372#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 12
3373template <class ELEMENT_TYPE, class ARGS_01,
3374 class ARGS_02,
3375 class ARGS_03,
3376 class ARGS_04,
3377 class ARGS_05,
3378 class ARGS_06,
3379 class ARGS_07,
3380 class ARGS_08,
3381 class ARGS_09,
3382 class ARGS_10,
3383 class ARGS_11,
3384 class ARGS_12>
3385inline
3386ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3387 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3388 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
3389 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
3390 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
3391 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
3392 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
3393 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
3394 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
3395 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
3396 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
3397 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11,
3398 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) args_12)
3399{
3401
3402 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3403
3404 UnqualElem *objPtr =
3405 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3406
3408 defaultAllocator, objPtr);
3409
3410 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3411 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3412 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
3413 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
3414 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
3415 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
3416 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
3417 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
3418 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
3419 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09),
3420 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, args_10),
3421 BSLS_COMPILERFEATURES_FORWARD(ARGS_11, args_11),
3422 BSLS_COMPILERFEATURES_FORWARD(ARGS_12, args_12));
3423 proctor.release();
3424
3425 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3426}
3427#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 12
3428
3429#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 13
3430template <class ELEMENT_TYPE, class ARGS_01,
3431 class ARGS_02,
3432 class ARGS_03,
3433 class ARGS_04,
3434 class ARGS_05,
3435 class ARGS_06,
3436 class ARGS_07,
3437 class ARGS_08,
3438 class ARGS_09,
3439 class ARGS_10,
3440 class ARGS_11,
3441 class ARGS_12,
3442 class ARGS_13>
3443inline
3444ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3445 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3446 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
3447 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
3448 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
3449 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
3450 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
3451 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
3452 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
3453 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
3454 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
3455 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11,
3456 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) args_12,
3457 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_13) args_13)
3458{
3460
3461 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3462
3463 UnqualElem *objPtr =
3464 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3465
3467 defaultAllocator, objPtr);
3468
3469 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3470 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3471 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
3472 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
3473 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
3474 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
3475 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
3476 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
3477 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
3478 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09),
3479 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, args_10),
3480 BSLS_COMPILERFEATURES_FORWARD(ARGS_11, args_11),
3481 BSLS_COMPILERFEATURES_FORWARD(ARGS_12, args_12),
3482 BSLS_COMPILERFEATURES_FORWARD(ARGS_13, args_13));
3483 proctor.release();
3484
3485 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3486}
3487#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 13
3488
3489#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 14
3490template <class ELEMENT_TYPE, class ARGS_01,
3491 class ARGS_02,
3492 class ARGS_03,
3493 class ARGS_04,
3494 class ARGS_05,
3495 class ARGS_06,
3496 class ARGS_07,
3497 class ARGS_08,
3498 class ARGS_09,
3499 class ARGS_10,
3500 class ARGS_11,
3501 class ARGS_12,
3502 class ARGS_13,
3503 class ARGS_14>
3504inline
3505ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3506 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3507 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
3508 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
3509 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
3510 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
3511 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
3512 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
3513 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
3514 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
3515 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
3516 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11,
3517 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) args_12,
3518 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_13) args_13,
3519 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_14) args_14)
3520{
3522
3523 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3524
3525 UnqualElem *objPtr =
3526 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3527
3529 defaultAllocator, objPtr);
3530
3531 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3532 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3533 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
3534 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
3535 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
3536 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
3537 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
3538 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
3539 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
3540 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09),
3541 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, args_10),
3542 BSLS_COMPILERFEATURES_FORWARD(ARGS_11, args_11),
3543 BSLS_COMPILERFEATURES_FORWARD(ARGS_12, args_12),
3544 BSLS_COMPILERFEATURES_FORWARD(ARGS_13, args_13),
3545 BSLS_COMPILERFEATURES_FORWARD(ARGS_14, args_14));
3546 proctor.release();
3547
3548 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3549}
3550#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 14
3551
3552
3553#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 0
3554template <class ELEMENT_TYPE>
3555inline
3556ManagedPtr<ELEMENT_TYPE>
3557ManagedPtrUtil::allocateManaged(bslma::Allocator *allocator)
3558{
3559 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3560
3561 allocator = bslma::Default::allocator(allocator);
3562
3563 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3564 allocator);
3565
3566 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3567}
3568#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 0
3569
3570#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 1
3571template <class ELEMENT_TYPE, class ARGS_01>
3572inline
3573ManagedPtr<ELEMENT_TYPE>
3574ManagedPtrUtil::allocateManaged(bslma::Allocator *allocator,
3575 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01)
3576{
3577 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3578
3579 allocator = bslma::Default::allocator(allocator);
3580
3581 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3582 allocator,
3583 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01));
3584
3585 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3586}
3587#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 1
3588
3589#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 2
3590template <class ELEMENT_TYPE, class ARGS_01,
3591 class ARGS_02>
3592inline
3593ManagedPtr<ELEMENT_TYPE>
3594ManagedPtrUtil::allocateManaged(bslma::Allocator *allocator,
3595 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3596 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02)
3597{
3598 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3599
3600 allocator = bslma::Default::allocator(allocator);
3601
3602 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3603 allocator,
3604 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3605 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02));
3606
3607 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3608}
3609#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 2
3610
3611#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 3
3612template <class ELEMENT_TYPE, class ARGS_01,
3613 class ARGS_02,
3614 class ARGS_03>
3615inline
3616ManagedPtr<ELEMENT_TYPE>
3617ManagedPtrUtil::allocateManaged(bslma::Allocator *allocator,
3618 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3619 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
3620 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03)
3621{
3622 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3623
3624 allocator = bslma::Default::allocator(allocator);
3625
3626 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3627 allocator,
3628 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3629 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
3630 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03));
3631
3632 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3633}
3634#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 3
3635
3636#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 4
3637template <class ELEMENT_TYPE, class ARGS_01,
3638 class ARGS_02,
3639 class ARGS_03,
3640 class ARGS_04>
3641inline
3642ManagedPtr<ELEMENT_TYPE>
3643ManagedPtrUtil::allocateManaged(bslma::Allocator *allocator,
3644 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3645 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
3646 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
3647 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04)
3648{
3649 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3650
3651 allocator = bslma::Default::allocator(allocator);
3652
3653 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3654 allocator,
3655 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3656 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
3657 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
3658 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04));
3659
3660 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3661}
3662#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 4
3663
3664#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 5
3665template <class ELEMENT_TYPE, class ARGS_01,
3666 class ARGS_02,
3667 class ARGS_03,
3668 class ARGS_04,
3669 class ARGS_05>
3670inline
3671ManagedPtr<ELEMENT_TYPE>
3672ManagedPtrUtil::allocateManaged(bslma::Allocator *allocator,
3673 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3674 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
3675 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
3676 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
3677 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05)
3678{
3679 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3680
3681 allocator = bslma::Default::allocator(allocator);
3682
3683 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3684 allocator,
3685 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3686 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
3687 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
3688 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
3689 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05));
3690
3691 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3692}
3693#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 5
3694
3695#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 6
3696template <class ELEMENT_TYPE, class ARGS_01,
3697 class ARGS_02,
3698 class ARGS_03,
3699 class ARGS_04,
3700 class ARGS_05,
3701 class ARGS_06>
3702inline
3703ManagedPtr<ELEMENT_TYPE>
3704ManagedPtrUtil::allocateManaged(bslma::Allocator *allocator,
3705 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3706 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
3707 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
3708 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
3709 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
3710 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06)
3711{
3712 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3713
3714 allocator = bslma::Default::allocator(allocator);
3715
3716 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3717 allocator,
3718 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3719 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
3720 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
3721 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
3722 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
3723 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06));
3724
3725 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3726}
3727#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 6
3728
3729#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 7
3730template <class ELEMENT_TYPE, class ARGS_01,
3731 class ARGS_02,
3732 class ARGS_03,
3733 class ARGS_04,
3734 class ARGS_05,
3735 class ARGS_06,
3736 class ARGS_07>
3737inline
3738ManagedPtr<ELEMENT_TYPE>
3739ManagedPtrUtil::allocateManaged(bslma::Allocator *allocator,
3740 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3741 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
3742 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
3743 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
3744 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
3745 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
3746 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07)
3747{
3748 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3749
3750 allocator = bslma::Default::allocator(allocator);
3751
3752 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3753 allocator,
3754 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3755 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
3756 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
3757 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
3758 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
3759 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
3760 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07));
3761
3762 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3763}
3764#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 7
3765
3766#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 8
3767template <class ELEMENT_TYPE, class ARGS_01,
3768 class ARGS_02,
3769 class ARGS_03,
3770 class ARGS_04,
3771 class ARGS_05,
3772 class ARGS_06,
3773 class ARGS_07,
3774 class ARGS_08>
3775inline
3776ManagedPtr<ELEMENT_TYPE>
3777ManagedPtrUtil::allocateManaged(bslma::Allocator *allocator,
3778 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3779 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
3780 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
3781 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
3782 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
3783 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
3784 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
3785 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08)
3786{
3787 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3788
3789 allocator = bslma::Default::allocator(allocator);
3790
3791 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3792 allocator,
3793 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3794 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
3795 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
3796 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
3797 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
3798 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
3799 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
3800 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08));
3801
3802 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3803}
3804#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 8
3805
3806#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 9
3807template <class ELEMENT_TYPE, class ARGS_01,
3808 class ARGS_02,
3809 class ARGS_03,
3810 class ARGS_04,
3811 class ARGS_05,
3812 class ARGS_06,
3813 class ARGS_07,
3814 class ARGS_08,
3815 class ARGS_09>
3816inline
3817ManagedPtr<ELEMENT_TYPE>
3818ManagedPtrUtil::allocateManaged(bslma::Allocator *allocator,
3819 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3820 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
3821 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
3822 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
3823 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
3824 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
3825 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
3826 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
3827 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09)
3828{
3829 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3830
3831 allocator = bslma::Default::allocator(allocator);
3832
3833 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3834 allocator,
3835 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3836 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
3837 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
3838 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
3839 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
3840 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
3841 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
3842 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
3843 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09));
3844
3845 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3846}
3847#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 9
3848
3849#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 10
3850template <class ELEMENT_TYPE, class ARGS_01,
3851 class ARGS_02,
3852 class ARGS_03,
3853 class ARGS_04,
3854 class ARGS_05,
3855 class ARGS_06,
3856 class ARGS_07,
3857 class ARGS_08,
3858 class ARGS_09,
3859 class ARGS_10>
3860inline
3861ManagedPtr<ELEMENT_TYPE>
3862ManagedPtrUtil::allocateManaged(bslma::Allocator *allocator,
3863 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3864 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
3865 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
3866 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
3867 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
3868 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
3869 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
3870 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
3871 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
3872 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10)
3873{
3874 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3875
3876 allocator = bslma::Default::allocator(allocator);
3877
3878 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3879 allocator,
3880 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3881 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
3882 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
3883 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
3884 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
3885 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
3886 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
3887 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
3888 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09),
3889 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, args_10));
3890
3891 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3892}
3893#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 10
3894
3895#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 11
3896template <class ELEMENT_TYPE, class ARGS_01,
3897 class ARGS_02,
3898 class ARGS_03,
3899 class ARGS_04,
3900 class ARGS_05,
3901 class ARGS_06,
3902 class ARGS_07,
3903 class ARGS_08,
3904 class ARGS_09,
3905 class ARGS_10,
3906 class ARGS_11>
3907inline
3908ManagedPtr<ELEMENT_TYPE>
3909ManagedPtrUtil::allocateManaged(bslma::Allocator *allocator,
3910 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3911 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
3912 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
3913 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
3914 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
3915 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
3916 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
3917 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
3918 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
3919 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
3920 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11)
3921{
3922 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3923
3924 allocator = bslma::Default::allocator(allocator);
3925
3926 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3927 allocator,
3928 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3929 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
3930 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
3931 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
3932 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
3933 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
3934 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
3935 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
3936 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09),
3937 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, args_10),
3938 BSLS_COMPILERFEATURES_FORWARD(ARGS_11, args_11));
3939
3940 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3941}
3942#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 11
3943
3944#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 12
3945template <class ELEMENT_TYPE, class ARGS_01,
3946 class ARGS_02,
3947 class ARGS_03,
3948 class ARGS_04,
3949 class ARGS_05,
3950 class ARGS_06,
3951 class ARGS_07,
3952 class ARGS_08,
3953 class ARGS_09,
3954 class ARGS_10,
3955 class ARGS_11,
3956 class ARGS_12>
3957inline
3958ManagedPtr<ELEMENT_TYPE>
3959ManagedPtrUtil::allocateManaged(bslma::Allocator *allocator,
3960 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
3961 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
3962 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
3963 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
3964 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
3965 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
3966 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
3967 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
3968 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
3969 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
3970 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11,
3971 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) args_12)
3972{
3973 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
3974
3975 allocator = bslma::Default::allocator(allocator);
3976
3977 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3978 allocator,
3979 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
3980 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
3981 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
3982 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
3983 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
3984 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
3985 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
3986 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
3987 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09),
3988 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, args_10),
3989 BSLS_COMPILERFEATURES_FORWARD(ARGS_11, args_11),
3990 BSLS_COMPILERFEATURES_FORWARD(ARGS_12, args_12));
3991
3992 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3993}
3994#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 12
3995
3996#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 13
3997template <class ELEMENT_TYPE, class ARGS_01,
3998 class ARGS_02,
3999 class ARGS_03,
4000 class ARGS_04,
4001 class ARGS_05,
4002 class ARGS_06,
4003 class ARGS_07,
4004 class ARGS_08,
4005 class ARGS_09,
4006 class ARGS_10,
4007 class ARGS_11,
4008 class ARGS_12,
4009 class ARGS_13>
4010inline
4011ManagedPtr<ELEMENT_TYPE>
4012ManagedPtrUtil::allocateManaged(bslma::Allocator *allocator,
4013 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
4014 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
4015 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
4016 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
4017 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
4018 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
4019 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
4020 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
4021 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
4022 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
4023 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11,
4024 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) args_12,
4025 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_13) args_13)
4026{
4027 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
4028
4029 allocator = bslma::Default::allocator(allocator);
4030
4031 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
4032 allocator,
4033 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
4034 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
4035 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
4036 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
4037 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
4038 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
4039 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
4040 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
4041 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09),
4042 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, args_10),
4043 BSLS_COMPILERFEATURES_FORWARD(ARGS_11, args_11),
4044 BSLS_COMPILERFEATURES_FORWARD(ARGS_12, args_12),
4045 BSLS_COMPILERFEATURES_FORWARD(ARGS_13, args_13));
4046
4047 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
4048}
4049#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 13
4050
4051#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 14
4052template <class ELEMENT_TYPE, class ARGS_01,
4053 class ARGS_02,
4054 class ARGS_03,
4055 class ARGS_04,
4056 class ARGS_05,
4057 class ARGS_06,
4058 class ARGS_07,
4059 class ARGS_08,
4060 class ARGS_09,
4061 class ARGS_10,
4062 class ARGS_11,
4063 class ARGS_12,
4064 class ARGS_13,
4065 class ARGS_14>
4066inline
4067ManagedPtr<ELEMENT_TYPE>
4068ManagedPtrUtil::allocateManaged(bslma::Allocator *allocator,
4069 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
4070 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
4071 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
4072 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
4073 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
4074 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
4075 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
4076 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
4077 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
4078 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10,
4079 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_11) args_11,
4080 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_12) args_12,
4081 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_13) args_13,
4082 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_14) args_14)
4083{
4084 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
4085
4086 allocator = bslma::Default::allocator(allocator);
4087
4088 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
4089 allocator,
4090 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
4091 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
4092 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
4093 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
4094 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
4095 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
4096 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
4097 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
4098 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09),
4099 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, args_10),
4100 BSLS_COMPILERFEATURES_FORWARD(ARGS_11, args_11),
4101 BSLS_COMPILERFEATURES_FORWARD(ARGS_12, args_12),
4102 BSLS_COMPILERFEATURES_FORWARD(ARGS_13, args_13),
4103 BSLS_COMPILERFEATURES_FORWARD(ARGS_14, args_14));
4104
4105 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
4106}
4107#endif // BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 14
4108
4109#else
4110// The generated code below is a workaround for the absence of perfect
4111// forwarding in some compilers.
4112
4113template <class ELEMENT_TYPE, class ALLOCATOR, class... ARGS>
4114inline
4116 ManagedPtr<ELEMENT_TYPE> >::type
4117ManagedPtrUtil::allocateManaged(const ALLOCATOR& allocator,
4119{
4120 return allocateManaged<ELEMENT_TYPE>(
4121 allocator.mechanism(),
4122 BSLS_COMPILERFEATURES_FORWARD(ARGS, args)...);
4123}
4124
4125template <class ELEMENT_TYPE, class... ARGS>
4126inline
4127ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
4129{
4131
4132 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
4133
4134 UnqualElem *objPtr =
4135 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
4136
4138 defaultAllocator, objPtr);
4139
4140 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
4141 BSLS_COMPILERFEATURES_FORWARD(ARGS, args)...);
4142 proctor.release();
4143
4144 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
4145}
4146
4147template <class ELEMENT_TYPE, class... ARGS>
4148inline
4149ManagedPtr<ELEMENT_TYPE>
4150ManagedPtrUtil::allocateManaged(bslma::Allocator *allocator,
4152{
4153 typedef typename bsl::remove_cv<ELEMENT_TYPE>::type UnqualElem;
4154
4155 allocator = bslma::Default::allocator(allocator);
4156
4157 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
4158 allocator,
4159 BSLS_COMPILERFEATURES_FORWARD(ARGS, args)...);
4160
4161 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
4162}
4163
4164// }}} END GENERATED CODE
4165#endif
4166
4167 // --------------------------
4168 // class ManagedPtrNilDeleter
4169 // --------------------------
4170
4171// CLASS METHODS
4172template <class TARGET_TYPE>
4173inline
4174void ManagedPtrNilDeleter<TARGET_TYPE>::deleter(void *, void *)
4175{
4176}
4177
4178 // ----------------------------------------
4179 // private struct ManagedPtr_DefaultDeleter
4180 // ----------------------------------------
4181
4182// CLASS METHODS
4183template <class MANAGED_TYPE>
4184inline
4185void ManagedPtr_DefaultDeleter<MANAGED_TYPE>::deleter(void *ptr, void *)
4186{
4187 delete reinterpret_cast<MANAGED_TYPE *>(ptr);
4188}
4189
4190} // close package namespace
4191
4192// ============================================================================
4193// TYPE TRAITS
4194// ============================================================================
4195
4196namespace bslmf {
4197
4198template <class TARGET_TYPE>
4199struct HasPointerSemantics<bslma::ManagedPtr<TARGET_TYPE> > : bsl::true_type
4200{
4201};
4202
4203template <class TARGET_TYPE>
4204struct IsBitwiseMoveable<bslma::ManagedPtr<TARGET_TYPE> > : bsl::true_type
4205{
4206};
4207
4208} // close namespace bslmf
4209
4210
4211namespace bsl {
4212
4213template <class TARGET_TYPE>
4214struct is_nothrow_move_constructible<
4215 BloombergLP::bslma::ManagedPtr<TARGET_TYPE> > : bsl::true_type
4216{
4217};
4218
4219} // close namespace bsl
4220
4221#else // if ! defined(DEFINED_BSLMA_MANAGEDPTR_H)
4222# error Not valid except when included from bslma_managedptr.h
4223#endif // ! defined(COMPILING_BSLMA_MANAGEDPTR_H)
4224
4225#endif // ! defined(INCLUDED_BSLMA_MANAGEDPTR_CPP03)
4226
4227// ----------------------------------------------------------------------------
4228// Copyright 2016 Bloomberg Finance L.P.
4229//
4230// Licensed under the Apache License, Version 2.0 (the "License");
4231// you may not use this file except in compliance with the License.
4232// You may obtain a copy of the License at
4233//
4234// http://www.apache.org/licenses/LICENSE-2.0
4235//
4236// Unless required by applicable law or agreed to in writing, software
4237// distributed under the License is distributed on an "AS IS" BASIS,
4238// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4239// See the License for the specific language governing permissions and
4240// limitations under the License.
4241// ----------------------------- END-OF-FILE ----------------------------------
4242
4243/** @} */
4244/** @} */
4245/** @} */
Definition bslma_allocator.h:457
Definition bslma_deallocateobjectproctor.h:273
void(* Deleter)(void *managedObject, void *cookie)
Deleter function prototype used to destroy the managed pointer.
Definition bslma_managedptrdeleter.h:115
~ManagedPtr_Ref()
Definition bslma_managedptr.h:1899
ManagedPtr_Ref & operator=(const ManagedPtr_Ref &original)=default
TARGET_TYPE * target() const
Return a pointer to the referenced object.
Definition bslma_managedptr.h:1914
ManagedPtr_Ref(ManagedPtr_Members *base, TARGET_TYPE *target)
Definition bslma_managedptr.h:1889
ManagedPtr_Members * base() const
Return a pointer to the managed state of a ManagedPtr object.
Definition bslma_managedptr.h:1907
Definition bslma_managedptr.h:1182
TARGET_TYPE * get() const
Definition bslma_managedptr.h:2546
TARGET_TYPE * ptr() const
Definition bslma_managedptr.h:2553
~ManagedPtr()
Definition bslma_managedptr.h:2218
bslmf::AddReference< TARGET_TYPE >::Type operator*() const
Definition bslma_managedptr.h:2521
const ManagedPtrDeleter & deleter() const
Definition bslma_managedptr.h:2537
void swap(ManagedPtr &other)
Definition bslma_managedptr.h:2499
TARGET_TYPE * operator->() const
Definition bslma_managedptr.h:2530
void clear()
Definition bslma_managedptr.h:2330
ManagedPtr & operator=(ManagedPtr &rhs) BSLS_KEYWORD_NOEXCEPT
Definition bslma_managedptr.h:2227
TARGET_TYPE element_type
Alias to the TARGET_TYPE template parameter.
Definition bslma_managedptr.h:1192
ManagedPtr_PairProxy< TARGET_TYPE, ManagedPtrDeleter > release()
Definition bslma_managedptr.h:2454
friend class ManagedPtr
Definition bslma_managedptr.h:1288
void reset()
Definition bslma_managedptr.h:2491
void loadAlias(ManagedPtr< ALIASED_TYPE > &alias, TARGET_TYPE *ptr)
Definition bslma_managedptr.h:2437
ManagedPtrDeleter::Deleter DeleterFunc
Definition bslma_managedptr.h:1189
Definition bslmf_movableref.h:751
static BoolType trueValue()
Return a value that converts to the bool value true.
Definition bsls_unspecifiedbool.h:223
int UnspecifiedBool::* BoolType
Definition bsls_unspecifiedbool.h:190
#define BSLMF_ASSERT(expr)
Definition bslmf_assert.h:229
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1762
#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
void swap(OptionValue &a, OptionValue &b)
void reset(TYPE *object)
Reset the value of the specified object to its default value.
Definition bdlb_printmethods.h:283
BloombergLP::bsls::Nullptr_Impl::Type nullptr_t
Definition bsls_nullptr.h:281
BSLS_KEYWORD_CONSTEXPR_CPP14 TYPE & get(array< TYPE, SIZE > &a) BSLS_KEYWORD_NOEXCEPT
Definition balxml_encoderoptions.h:68
Definition bdlbb_blob.h:576
Definition bdlt_iso8601util.h:691
Definition bslmf_conditional.h:120
Definition bslmf_enableif.h:525
Definition bslmf_isconvertible.h:867
Definition bslmf_isvoid.h:138
remove_const< typenameremove_volatile< t_TYPE >::type >::type type
Definition bslmf_removecv.h:126
static Allocator * allocator(Allocator *basicAllocator=0)
Definition bslma_default.h:897
static Allocator * defaultAllocator()
Definition bslma_default.h:889
static void deleter(void *, void *)
Deleter function that does nothing.
Definition bslma_managedptr.h:2632
static ManagedPtr< ELEMENT_TYPE > makeManaged(ARGS &&... args)
Definition bslma_managedptr.h:2585
static ManagedPtr< ELEMENT_TYPE > allocateManaged(bslma::Allocator *allocator, ARGS &&... args)
Definition bslma_managedptr.h:2610
static void noOpDeleter(void *, void *)
Deleter function that does nothing.
static void deleter(void *ptr, void *)
Definition bslma_managedptr.h:2643
static void * voidify(TYPE *address) BSLS_KEYWORD_NOEXCEPT
Definition bslma_managedptr.h:1868
static TYPE * unqualify(const volatile TYPE *address) BSLS_KEYWORD_NOEXCEPT
Definition bslma_managedptr.h:1876
bsl::add_lvalue_reference< t_TYPE >::type Type
Definition bslmf_addreference.h:188
Definition bslmf_movableref.h:791