11#ifndef INCLUDED_BSLMA_MANAGEDPTR_CPP03
12#define INCLUDED_BSLMA_MANAGEDPTR_CPP03
63#ifdef COMPILING_BSLMA_MANAGEDPTR_H
74struct ManagedPtr_ImpUtil {
105template <
class TARGET_TYPE>
106class ManagedPtr_Ref {
109 ManagedPtr_Members *d_base_p;
112 TARGET_TYPE *d_cast_p;
142 ManagedPtr_Members *
base()
const;
145 TARGET_TYPE *
target()
const;
154struct ManagedPtr_TraitConstraint {
182template <
class TARGET_TYPE>
212 ManagedPtr_Members d_members;
224 static void *stripBasePointerType(TARGET_TYPE *
ptr);
230 template <
class MANAGED_TYPE>
231 static void *stripCompletePointerType(MANAGED_TYPE *
ptr);
244 template <
class MANAGED_TYPE>
252 template <
class MANAGED_TYPE>
260 template <
class MANAGED_TYPE,
class COOKIE_TYPE>
268 template <
class MANAGED_TYPE>
270 template <
class COOKIE_TYPE>
288 template <
class ALIASED_TYPE>
311 template <
class MANAGED_TYPE>
339#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
340 template <
class BDE_OTHER_TYPE>
341 ManagedPtr(ManagedPtr<BDE_OTHER_TYPE>&& original,
344 ManagedPtr_TraitConstraint>::type =
345 ManagedPtr_TraitConstraint())
347#elif defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
349 template <
class BDE_OTHER_TYPE>
353 template <
class BDE_OTHER_TYPE>
357 ManagedPtr_TraitConstraint>::type =
358 ManagedPtr_TraitConstraint())
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)
395 template <
class MANAGED_TYPE,
class FACTORY_TYPE>
406 template <
class FACTORY_TYPE>
433 template <
class MANAGED_TYPE>
436#ifndef BDE_OMIT_INTERNAL_DEPRECATED
460 template <
class MANAGED_TYPE,
class MANAGED_BASE>
463 void (*
deleter)(MANAGED_BASE *,
void *));
485 template <
class MANAGED_TYPE,
491 void (*
deleter)(MANAGED_BASE *, COOKIE_BASE *));
521#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
522 template <
class BDE_OTHER_TYPE>
525 ManagedPtr<TARGET_TYPE> >::type&
527#elif defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
529 template <
class BDE_OTHER_TYPE>
530 ManagedPtr<TARGET_TYPE>&
534 template <
class BDE_OTHER_TYPE>
537 ManagedPtr<TARGET_TYPE> >::type&
566 template <
class REFERENCED_TYPE>
567 operator ManagedPtr_Ref<REFERENCED_TYPE>();
588 template <
class MANAGED_TYPE>
589 void load(MANAGED_TYPE *
ptr);
607 template <
class MANAGED_TYPE,
class FACTORY_TYPE>
608 void load(MANAGED_TYPE *
ptr, FACTORY_TYPE *factory);
623 template <
class MANAGED_TYPE>
632#ifndef BDE_OMIT_INTERNAL_DEPRECATED
633 template <
class MANAGED_TYPE,
class COOKIE_TYPE>
636 template <
class MANAGED_TYPE,
class MANAGED_BASE>
637 void load(MANAGED_TYPE *
ptr,
639 void (*
deleter)(MANAGED_BASE *,
void *));
661 template <
class MANAGED_TYPE,
665 void load(MANAGED_TYPE *
ptr,
667 void (*
deleter)(MANAGED_BASE *, COOKIE_BASE *));
683 template <
class ALIASED_TYPE>
684 void loadAlias(ManagedPtr<ALIASED_TYPE>& alias, TARGET_TYPE *
ptr);
690 ManagedPtr_PairProxy<TARGET_TYPE, ManagedPtrDeleter>
release();
718 operator BoolType()
const;
732 const ManagedPtrDeleter&
deleter()
const;
736 TARGET_TYPE *
get()
const;
742 TARGET_TYPE *
ptr()
const;
749template <
class TARGET_TYPE>
750void swap(ManagedPtr<TARGET_TYPE>& a, ManagedPtr<TARGET_TYPE>& b);
758struct ManagedPtrUtil {
765#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
768#ifndef BSLMA_MANAGEDPTR_VARIADIC_LIMIT
769#define BSLMA_MANAGEDPTR_VARIADIC_LIMIT 14
771#ifndef BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A
772#define BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A BSLMA_MANAGEDPTR_VARIADIC_LIMIT
775#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 0
776 template <
class ELEMENT_TYPE>
777 static ManagedPtr<ELEMENT_TYPE>
781#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 1
782 template <
class ELEMENT_TYPE,
class ARGS_01>
783 static ManagedPtr<ELEMENT_TYPE>
788#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 2
789 template <
class ELEMENT_TYPE,
class ARGS_01,
791 static ManagedPtr<ELEMENT_TYPE>
797#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 3
798 template <
class ELEMENT_TYPE,
class ARGS_01,
801 static ManagedPtr<ELEMENT_TYPE>
808#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 4
809 template <
class ELEMENT_TYPE,
class ARGS_01,
813 static ManagedPtr<ELEMENT_TYPE>
821#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 5
822 template <
class ELEMENT_TYPE,
class ARGS_01,
827 static ManagedPtr<ELEMENT_TYPE>
836#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 6
837 template <
class ELEMENT_TYPE,
class ARGS_01,
843 static ManagedPtr<ELEMENT_TYPE>
853#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 7
854 template <
class ELEMENT_TYPE,
class ARGS_01,
861 static ManagedPtr<ELEMENT_TYPE>
872#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 8
873 template <
class ELEMENT_TYPE,
class ARGS_01,
881 static ManagedPtr<ELEMENT_TYPE>
893#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 9
894 template <
class ELEMENT_TYPE,
class ARGS_01,
903 static ManagedPtr<ELEMENT_TYPE>
916#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 10
917 template <
class ELEMENT_TYPE,
class ARGS_01,
927 static ManagedPtr<ELEMENT_TYPE>
941#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 11
942 template <
class ELEMENT_TYPE,
class ARGS_01,
953 static ManagedPtr<ELEMENT_TYPE>
968#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 12
969 template <
class ELEMENT_TYPE,
class ARGS_01,
981 static ManagedPtr<ELEMENT_TYPE>
997#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 13
998 template <
class ELEMENT_TYPE,
class ARGS_01,
1011 static ManagedPtr<ELEMENT_TYPE>
1028#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 14
1029 template <
class ELEMENT_TYPE,
class ARGS_01,
1043 static ManagedPtr<ELEMENT_TYPE>
1061#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 0
1062 template <
class ELEMENT_TYPE,
class ALLOCATOR>
1064 ManagedPtr<ELEMENT_TYPE> >::type
1068#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 1
1069 template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01>
1071 ManagedPtr<ELEMENT_TYPE> >::type
1076#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 2
1077 template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
1080 ManagedPtr<ELEMENT_TYPE> >::type
1086#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 3
1087 template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
1091 ManagedPtr<ELEMENT_TYPE> >::type
1098#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 4
1099 template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
1104 ManagedPtr<ELEMENT_TYPE> >::type
1112#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 5
1113 template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
1119 ManagedPtr<ELEMENT_TYPE> >::type
1128#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 6
1129 template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
1136 ManagedPtr<ELEMENT_TYPE> >::type
1146#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 7
1147 template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
1155 ManagedPtr<ELEMENT_TYPE> >::type
1166#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 8
1167 template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
1176 ManagedPtr<ELEMENT_TYPE> >::type
1188#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 9
1189 template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
1199 ManagedPtr<ELEMENT_TYPE> >::type
1212#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 10
1213 template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
1224 ManagedPtr<ELEMENT_TYPE> >::type
1238#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 11
1239 template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
1251 ManagedPtr<ELEMENT_TYPE> >::type
1266#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 12
1267 template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
1280 ManagedPtr<ELEMENT_TYPE> >::type
1296#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 13
1297 template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
1311 ManagedPtr<ELEMENT_TYPE> >::type
1328#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 14
1329 template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
1344 ManagedPtr<ELEMENT_TYPE> >::type
1363#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 0
1364 template <
class ELEMENT_TYPE>
1369#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 1
1370 template <
class ELEMENT_TYPE,
class ARGS_01>
1375#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 2
1376 template <
class ELEMENT_TYPE,
class ARGS_01,
1383#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 3
1384 template <
class ELEMENT_TYPE,
class ARGS_01,
1393#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 4
1394 template <
class ELEMENT_TYPE,
class ARGS_01,
1405#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 5
1406 template <
class ELEMENT_TYPE,
class ARGS_01,
1419#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 6
1420 template <
class ELEMENT_TYPE,
class ARGS_01,
1435#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 7
1436 template <
class ELEMENT_TYPE,
class ARGS_01,
1453#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 8
1454 template <
class ELEMENT_TYPE,
class ARGS_01,
1473#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 9
1474 template <
class ELEMENT_TYPE,
class ARGS_01,
1495#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 10
1496 template <
class ELEMENT_TYPE,
class ARGS_01,
1519#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 11
1520 template <
class ELEMENT_TYPE,
class ARGS_01,
1545#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 12
1546 template <
class ELEMENT_TYPE,
class ARGS_01,
1573#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 13
1574 template <
class ELEMENT_TYPE,
class ARGS_01,
1603#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_A >= 14
1604 template <
class ELEMENT_TYPE,
class ARGS_01,
1639 template <
class ELEMENT_TYPE,
class... ARGS>
1640 static ManagedPtr<ELEMENT_TYPE>
1643 template <
class ELEMENT_TYPE,
class ALLOCATOR,
class... ARGS>
1645 ManagedPtr<ELEMENT_TYPE> >::type
1649 template <
class ELEMENT_TYPE,
class... ARGS>
1668template <
class TARGET_TYPE>
1669struct ManagedPtrNilDeleter {
1674 static void deleter(
void *,
void *);
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> > {
1703template <
class MANAGED_TYPE>
1704struct ManagedPtr_DefaultDeleter {
1710 static void deleter(
void *ptr,
void *);
1723template <
class TYPE>
1727 return static_cast<void *
>(
1731template <
class TYPE>
1736 return const_cast<TYPE *
>(address);
1744template <
class TARGET_TYPE>
1747 TARGET_TYPE *target)
1754template <
class TARGET_TYPE>
1756ManagedPtr_Ref<TARGET_TYPE>::~ManagedPtr_Ref()
1762template <
class TARGET_TYPE>
1764ManagedPtr_Members *ManagedPtr_Ref<TARGET_TYPE>::base()
const
1769template <
class TARGET_TYPE>
1771TARGET_TYPE *ManagedPtr_Ref<TARGET_TYPE>::target()
const
1780template <
class TARGET_TYPE>
1781class ManagedPtr<volatile TARGET_TYPE>;
1787template <
class TARGET_TYPE>
1788class ManagedPtr<TARGET_TYPE&>;
1794#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
1795template <
class TARGET_TYPE>
1796class ManagedPtr<TARGET_TYPE&&>;
1804template <
class TARGET_TYPE>
1806void *ManagedPtr<TARGET_TYPE>::stripBasePointerType(TARGET_TYPE *ptr)
1808 return const_cast<void *
>(
static_cast<const void *
>(ptr));
1811template <
class TARGET_TYPE>
1812template <
class MANAGED_TYPE>
1815ManagedPtr<TARGET_TYPE>::stripCompletePointerType(MANAGED_TYPE *ptr)
1817 return const_cast<void *
>(
static_cast<const void *
>(ptr));
1821template <
class TARGET_TYPE>
1822template <
class MANAGED_TYPE>
1824void ManagedPtr<TARGET_TYPE>::loadImp(MANAGED_TYPE *ptr,
1826 DeleterFunc deleter)
1831 d_members.runDeleter();
1832 d_members.set(stripCompletePointerType(ptr), cookie, deleter);
1833 d_members.setAliasPtr(stripBasePointerType(ptr));
1837template <
class TARGET_TYPE>
1839ManagedPtr<TARGET_TYPE>::ManagedPtr()
1844template <
class TARGET_TYPE>
1845template <
class MANAGED_TYPE>
1847ManagedPtr<TARGET_TYPE>::ManagedPtr(MANAGED_TYPE *ptr)
1848: d_members(stripCompletePointerType(ptr),
1850 &ManagedPtr_DefaultDeleter<MANAGED_TYPE>::deleter,
1851 stripBasePointerType(ptr))
1856template <
class TARGET_TYPE>
1858ManagedPtr<TARGET_TYPE>::ManagedPtr(ManagedPtr_Ref<TARGET_TYPE> ref)
1860: d_members(*ref.base())
1862 d_members.setAliasPtr(stripBasePointerType(ref.target()));
1865template <
class TARGET_TYPE>
1868: d_members(original.d_members)
1872template <
class TARGET_TYPE>
1876: d_members(MoveUtil::access(original).d_members)
1880#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
1881 template <
class TARGET_TYPE>
1882 template <
class BDE_OTHER_TYPE>
1884 ManagedPtr<TARGET_TYPE>::ManagedPtr(
1885 ManagedPtr<BDE_OTHER_TYPE> &&original,
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
1893 template <
class TARGET_TYPE>
1894 template <
class BDE_OTHER_TYPE>
1896 ManagedPtr<TARGET_TYPE>::ManagedPtr(
1899 : d_members(MoveUtil::access(original).d_members)
1901 template <
class TARGET_TYPE>
1902 template <
class BDE_OTHER_TYPE>
1904 ManagedPtr<TARGET_TYPE>::ManagedPtr(
1907 TARGET_TYPE *>::value,
1908 ManagedPtr_TraitConstraint>::type)
1910 : d_members(MoveUtil::access(original).d_members)
1915 #if defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
1917 TARGET_TYPE *>::value));
1922 d_members.setAliasPtr(
1923 stripBasePointerType(
1924 static_cast<TARGET_TYPE *
>(
1925 static_cast<BDE_OTHER_TYPE *
>(
1926 d_members.pointer()))));
1930template <
class TARGET_TYPE>
1931template <
class ALIASED_TYPE>
1933ManagedPtr<TARGET_TYPE>::ManagedPtr(ManagedPtr<ALIASED_TYPE>& alias,
1940 d_members.move(&alias.d_members);
1941 d_members.setAliasPtr(stripBasePointerType(ptr));
1945template <
class TARGET_TYPE>
1946template <
class ALIASED_TYPE>
1948ManagedPtr<TARGET_TYPE>::ManagedPtr(
1949#
if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
1950 ManagedPtr<ALIASED_TYPE>&& alias,
1957 ManagedPtr<ALIASED_TYPE>& lvalue = alias;
1962 d_members.move(&lvalue.d_members);
1963 d_members.setAliasPtr(stripBasePointerType(ptr));
1967template <
class TARGET_TYPE>
1968template <
class MANAGED_TYPE,
class FACTORY_TYPE>
1970ManagedPtr<TARGET_TYPE>::ManagedPtr(MANAGED_TYPE *ptr, FACTORY_TYPE *factory)
1971: d_members(stripCompletePointerType(ptr),
1973 &ManagedPtr_FactoryDeleterType<MANAGED_TYPE,
1974 FACTORY_TYPE>::type::deleter,
1975 stripBasePointerType(ptr))
1981template <
class TARGET_TYPE>
1988template <
class TARGET_TYPE>
1989template <
class FACTORY_TYPE>
1991ManagedPtr<TARGET_TYPE>::ManagedPtr(
bsl::nullptr_t, FACTORY_TYPE *)
1996template <
class TARGET_TYPE>
1998ManagedPtr<TARGET_TYPE>::ManagedPtr(TARGET_TYPE *ptr,
2000 DeleterFunc deleter)
2001: d_members(stripBasePointerType(ptr), cookie, deleter)
2006template <
class TARGET_TYPE>
2007template <
class MANAGED_TYPE>
2009ManagedPtr<TARGET_TYPE>::ManagedPtr(MANAGED_TYPE *ptr,
2011 DeleterFunc deleter)
2012: d_members(stripCompletePointerType(ptr),
2015 stripBasePointerType(ptr))
2022#ifndef BDE_OMIT_INTERNAL_DEPRECATED
2023template <
class TARGET_TYPE>
2024template <
class MANAGED_TYPE,
class MANAGED_BASE>
2026ManagedPtr<TARGET_TYPE>::ManagedPtr(
2029 void (*deleter)(MANAGED_BASE *,
void *))
2030: d_members(stripCompletePointerType(ptr),
2032 reinterpret_cast<DeleterFunc>(deleter),
2033 stripBasePointerType(ptr))
2037 const MANAGED_BASE *>::value));
2042template <
class TARGET_TYPE>
2043template <
class MANAGED_TYPE,
2048ManagedPtr<TARGET_TYPE>::ManagedPtr(
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))
2059 const MANAGED_BASE *>::value));
2073template <
class TARGET_TYPE>
2075ManagedPtr<TARGET_TYPE>::~ManagedPtr()
2077 d_members.runDeleter();
2081template <
class TARGET_TYPE>
2083ManagedPtr<TARGET_TYPE>&
2086 d_members.moveAssign(&rhs.d_members);
2090template <
class TARGET_TYPE>
2092ManagedPtr<TARGET_TYPE>&
2096 ManagedPtr& lvalue = rhs;
2097 d_members.moveAssign(&lvalue.d_members);
2101#if defined(BSLMF_MOVABLEREF_USES_RVALUE_REFERENCES)
2102 template <
class TARGET_TYPE>
2103 template <
class BDE_OTHER_TYPE>
2107 ManagedPtr<TARGET_TYPE> >::type&
2108 ManagedPtr<TARGET_TYPE>::operator =(
2110#elif defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
2112 template <
class TARGET_TYPE>
2113 template <
class BDE_OTHER_TYPE>
2115 ManagedPtr<TARGET_TYPE>&
2116 ManagedPtr<TARGET_TYPE>::operator =(
2120 template <
class TARGET_TYPE>
2121 template <
class BDE_OTHER_TYPE>
2125 ManagedPtr<TARGET_TYPE> >::type&
2126 ManagedPtr<TARGET_TYPE>::operator =(
2133 #if defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
2135 TARGET_TYPE *>::value));
2138 ManagedPtr<BDE_OTHER_TYPE>& lvalue = rhs;
2139 d_members.moveAssign(&lvalue.d_members);
2143 d_members.setAliasPtr(
2144 stripBasePointerType(
2145 static_cast<TARGET_TYPE *
>(
2146 static_cast<BDE_OTHER_TYPE *
>(
2147 d_members.pointer()))));
2152template <
class TARGET_TYPE>
2154ManagedPtr<TARGET_TYPE>&
2155ManagedPtr<TARGET_TYPE>::operator=(ManagedPtr_Ref<TARGET_TYPE> ref)
2158 d_members.moveAssign(ref.base());
2159 d_members.setAliasPtr(stripBasePointerType(ref.target()));
2163template <
class TARGET_TYPE>
2165ManagedPtr<TARGET_TYPE>&
2172template <
class TARGET_TYPE>
2173template <
class REFERENCED_TYPE>
2175ManagedPtr<TARGET_TYPE>::operator ManagedPtr_Ref<REFERENCED_TYPE>()
2178 REFERENCED_TYPE *>::value));
2180 return ManagedPtr_Ref<REFERENCED_TYPE>(&d_members,
2181 static_cast<REFERENCED_TYPE *
>(
2182 static_cast<TARGET_TYPE *
>(d_members.pointer())));
2185template <
class TARGET_TYPE>
2187void ManagedPtr<TARGET_TYPE>::clear()
2192template <
class TARGET_TYPE>
2193template <
class MANAGED_TYPE>
2195void ManagedPtr<TARGET_TYPE>::load(MANAGED_TYPE *ptr)
2199 typedef ManagedPtr_FactoryDeleter<MANAGED_TYPE, Allocator> DeleterFactory;
2201 static_cast<void *
>(Default::allocator()),
2202 &DeleterFactory::deleter);
2205template <
class TARGET_TYPE>
2206template <
class MANAGED_TYPE,
class FACTORY_TYPE>
2208void ManagedPtr<TARGET_TYPE>::load(MANAGED_TYPE *ptr, FACTORY_TYPE *factory)
2214 ManagedPtr_FactoryDeleterType<MANAGED_TYPE, FACTORY_TYPE>::type
2217 this->loadImp(ptr,
static_cast<void *
>(factory), &DeleterFactory::deleter);
2220template <
class TARGET_TYPE>
2221template <
class MANAGED_TYPE>
2223void ManagedPtr<TARGET_TYPE>::load(MANAGED_TYPE *ptr,
2225 DeleterFunc deleter)
2230 this->loadImp(ptr, cookie, deleter);
2233template <
class TARGET_TYPE>
2235void ManagedPtr<TARGET_TYPE>::load(
bsl::nullptr_t,
void *, DeleterFunc)
2240#ifndef BDE_OMIT_INTERNAL_DEPRECATED
2241template <
class TARGET_TYPE>
2242template <
class MANAGED_TYPE,
class COOKIE_TYPE>
2244void ManagedPtr<TARGET_TYPE>::load(MANAGED_TYPE *ptr,
2245 COOKIE_TYPE *cookie,
2246 DeleterFunc deleter)
2251 this->loadImp(ptr,
static_cast<void *
>(cookie), deleter);
2254template <
class TARGET_TYPE>
2255template <
class MANAGED_TYPE,
class MANAGED_BASE>
2257void ManagedPtr<TARGET_TYPE>::load(
2260 void (*deleter)(MANAGED_BASE *,
void *))
2267 this->loadImp(ptr, cookie,
reinterpret_cast<DeleterFunc
>(deleter));
2270template <
class TARGET_TYPE>
2271template <
class MANAGED_TYPE,
2276void ManagedPtr<TARGET_TYPE>::load(
2278 COOKIE_TYPE *cookie,
2279 void (*deleter)(MANAGED_BASE *, COOKIE_BASE *))
2287 static_cast<void *
>(
static_cast<COOKIE_BASE *
>(cookie)),
2288 reinterpret_cast<DeleterFunc
>(deleter));
2292template <
class TARGET_TYPE>
2293template <
class ALIASED_TYPE>
2294void ManagedPtr<TARGET_TYPE>::loadAlias(ManagedPtr<ALIASED_TYPE>& alias,
2299 if (ptr && alias.d_members.pointer()) {
2300 d_members.moveAssign(&alias.d_members);
2301 d_members.setAliasPtr(stripBasePointerType(ptr));
2304 d_members.runDeleter();
2309template <
class TARGET_TYPE>
2310ManagedPtr_PairProxy<TARGET_TYPE, ManagedPtrDeleter>
2311ManagedPtr<TARGET_TYPE>::release()
2313 typedef ManagedPtr_PairProxy<TARGET_TYPE, ManagedPtrDeleter> ResultType;
2315 TARGET_TYPE *p =
get();
2321 ResultType result = { p, d_members.deleter() };
2325 ResultType result = { p, ManagedPtrDeleter() };
2329template <
class TARGET_TYPE>
2330TARGET_TYPE *ManagedPtr<TARGET_TYPE>::release(ManagedPtrDeleter *deleter)
2334 TARGET_TYPE *result =
get();
2340 *deleter = d_members.deleter();
2346template <
class TARGET_TYPE>
2348void ManagedPtr<TARGET_TYPE>::reset()
2350 d_members.runDeleter();
2354template <
class TARGET_TYPE>
2356void ManagedPtr<TARGET_TYPE>::swap(ManagedPtr& other)
2358 d_members.swap(other.d_members);
2362template <
class TARGET_TYPE>
2364#if defined(BSLS_PLATFORM_CMP_IBM)
2365ManagedPtr<TARGET_TYPE>::operator
typename ManagedPtr::BoolType() const
2367ManagedPtr<TARGET_TYPE>::operator BoolType() const
2370 return d_members.pointer()
2372 :
bsls::UnspecifiedBool<ManagedPtr>::falseValue();
2375template <
class TARGET_TYPE>
2378ManagedPtr<TARGET_TYPE>::operator*()
const
2382 return *
static_cast<TARGET_TYPE *
>(d_members.pointer());
2385template <
class TARGET_TYPE>
2387TARGET_TYPE *ManagedPtr<TARGET_TYPE>::operator->()
const
2389 return static_cast<TARGET_TYPE *
>(d_members.pointer());
2392template <
class TARGET_TYPE>
2394const ManagedPtrDeleter& ManagedPtr<TARGET_TYPE>::deleter()
const
2398 return d_members.deleter();
2401template <
class TARGET_TYPE>
2403TARGET_TYPE *ManagedPtr<TARGET_TYPE>::get()
const
2405 return static_cast<TARGET_TYPE *
>(d_members.pointer());
2408template <
class TARGET_TYPE>
2410TARGET_TYPE *ManagedPtr<TARGET_TYPE>::ptr()
const
2416template <
class TARGET_TYPE>
2418void swap(ManagedPtr<TARGET_TYPE>& a, ManagedPtr<TARGET_TYPE>& b)
2427#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
2430#ifndef BSLMA_MANAGEDPTR_VARIADIC_LIMIT
2431#define BSLMA_MANAGEDPTR_VARIADIC_LIMIT 14
2433#ifndef BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B
2434#define BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B BSLMA_MANAGEDPTR_VARIADIC_LIMIT
2437#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 0
2438template <
class ELEMENT_TYPE,
class ALLOCATOR>
2441 ManagedPtr<ELEMENT_TYPE> >::type
2442ManagedPtrUtil::allocateManaged(
const ALLOCATOR& allocator)
2444 return allocateManaged<ELEMENT_TYPE>(
2445 allocator.mechanism());
2449#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 1
2450template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01>
2453 ManagedPtr<ELEMENT_TYPE> >::type
2454ManagedPtrUtil::allocateManaged(
const ALLOCATOR& allocator,
2457 return allocateManaged<ELEMENT_TYPE>(
2458 allocator.mechanism(),
2463#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 2
2464template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
2468 ManagedPtr<ELEMENT_TYPE> >::type
2469ManagedPtrUtil::allocateManaged(
const ALLOCATOR& allocator,
2473 return allocateManaged<ELEMENT_TYPE>(
2474 allocator.mechanism(),
2480#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 3
2481template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
2486 ManagedPtr<ELEMENT_TYPE> >::type
2487ManagedPtrUtil::allocateManaged(
const ALLOCATOR& allocator,
2492 return allocateManaged<ELEMENT_TYPE>(
2493 allocator.mechanism(),
2500#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 4
2501template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
2507 ManagedPtr<ELEMENT_TYPE> >::type
2508ManagedPtrUtil::allocateManaged(
const ALLOCATOR& allocator,
2514 return allocateManaged<ELEMENT_TYPE>(
2515 allocator.mechanism(),
2523#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 5
2524template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
2531 ManagedPtr<ELEMENT_TYPE> >::type
2532ManagedPtrUtil::allocateManaged(
const ALLOCATOR& allocator,
2539 return allocateManaged<ELEMENT_TYPE>(
2540 allocator.mechanism(),
2549#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 6
2550template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
2558 ManagedPtr<ELEMENT_TYPE> >::type
2559ManagedPtrUtil::allocateManaged(
const ALLOCATOR& allocator,
2567 return allocateManaged<ELEMENT_TYPE>(
2568 allocator.mechanism(),
2578#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 7
2579template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
2588 ManagedPtr<ELEMENT_TYPE> >::type
2589ManagedPtrUtil::allocateManaged(
const ALLOCATOR& allocator,
2598 return allocateManaged<ELEMENT_TYPE>(
2599 allocator.mechanism(),
2610#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 8
2611template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
2621 ManagedPtr<ELEMENT_TYPE> >::type
2622ManagedPtrUtil::allocateManaged(
const ALLOCATOR& allocator,
2632 return allocateManaged<ELEMENT_TYPE>(
2633 allocator.mechanism(),
2645#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 9
2646template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
2657 ManagedPtr<ELEMENT_TYPE> >::type
2658ManagedPtrUtil::allocateManaged(
const ALLOCATOR& allocator,
2669 return allocateManaged<ELEMENT_TYPE>(
2670 allocator.mechanism(),
2683#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 10
2684template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
2696 ManagedPtr<ELEMENT_TYPE> >::type
2697ManagedPtrUtil::allocateManaged(
const ALLOCATOR& allocator,
2709 return allocateManaged<ELEMENT_TYPE>(
2710 allocator.mechanism(),
2724#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 11
2725template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
2738 ManagedPtr<ELEMENT_TYPE> >::type
2739ManagedPtrUtil::allocateManaged(
const ALLOCATOR& allocator,
2752 return allocateManaged<ELEMENT_TYPE>(
2753 allocator.mechanism(),
2768#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 12
2769template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
2783 ManagedPtr<ELEMENT_TYPE> >::type
2784ManagedPtrUtil::allocateManaged(
const ALLOCATOR& allocator,
2798 return allocateManaged<ELEMENT_TYPE>(
2799 allocator.mechanism(),
2815#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 13
2816template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
2831 ManagedPtr<ELEMENT_TYPE> >::type
2832ManagedPtrUtil::allocateManaged(
const ALLOCATOR& allocator,
2847 return allocateManaged<ELEMENT_TYPE>(
2848 allocator.mechanism(),
2865#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 14
2866template <
class ELEMENT_TYPE,
class ALLOCATOR,
class ARGS_01,
2882 ManagedPtr<ELEMENT_TYPE> >::type
2883ManagedPtrUtil::allocateManaged(
const ALLOCATOR& allocator,
2899 return allocateManaged<ELEMENT_TYPE>(
2900 allocator.mechanism(),
2919#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 0
2920template <
class ELEMENT_TYPE>
2922ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
2929 UnqualElem *objPtr =
2930 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
2933 defaultAllocator, objPtr);
2935 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
2939 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
2943#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 1
2944template <
class ELEMENT_TYPE,
class ARGS_01>
2946ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
2953 UnqualElem *objPtr =
2954 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
2957 defaultAllocator, objPtr);
2959 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
2963 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
2967#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 2
2968template <
class ELEMENT_TYPE,
class ARGS_01,
2971ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
2979 UnqualElem *objPtr =
2980 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
2983 defaultAllocator, objPtr);
2985 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
2990 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
2994#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 3
2995template <
class ELEMENT_TYPE,
class ARGS_01,
2999ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3008 UnqualElem *objPtr =
3009 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3012 defaultAllocator, objPtr);
3014 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3020 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3024#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 4
3025template <
class ELEMENT_TYPE,
class ARGS_01,
3030ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3040 UnqualElem *objPtr =
3041 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3044 defaultAllocator, objPtr);
3046 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3053 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3057#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 5
3058template <
class ELEMENT_TYPE,
class ARGS_01,
3064ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3075 UnqualElem *objPtr =
3076 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3079 defaultAllocator, objPtr);
3081 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3089 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3093#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 6
3094template <
class ELEMENT_TYPE,
class ARGS_01,
3101ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3113 UnqualElem *objPtr =
3114 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3117 defaultAllocator, objPtr);
3119 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3128 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3132#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 7
3133template <
class ELEMENT_TYPE,
class ARGS_01,
3141ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3154 UnqualElem *objPtr =
3155 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3158 defaultAllocator, objPtr);
3160 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3170 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3174#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 8
3175template <
class ELEMENT_TYPE,
class ARGS_01,
3184ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3198 UnqualElem *objPtr =
3199 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3202 defaultAllocator, objPtr);
3204 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3215 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3219#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 9
3220template <
class ELEMENT_TYPE,
class ARGS_01,
3230ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3245 UnqualElem *objPtr =
3246 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3249 defaultAllocator, objPtr);
3251 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3263 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3267#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 10
3268template <
class ELEMENT_TYPE,
class ARGS_01,
3279ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3295 UnqualElem *objPtr =
3296 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3299 defaultAllocator, objPtr);
3301 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3314 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3318#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 11
3319template <
class ELEMENT_TYPE,
class ARGS_01,
3331ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3348 UnqualElem *objPtr =
3349 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3352 defaultAllocator, objPtr);
3354 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3368 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3372#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 12
3373template <
class ELEMENT_TYPE,
class ARGS_01,
3386ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3404 UnqualElem *objPtr =
3405 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3408 defaultAllocator, objPtr);
3410 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3425 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3429#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 13
3430template <
class ELEMENT_TYPE,
class ARGS_01,
3444ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3463 UnqualElem *objPtr =
3464 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3467 defaultAllocator, objPtr);
3469 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3485 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3489#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 14
3490template <
class ELEMENT_TYPE,
class ARGS_01,
3505ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
3525 UnqualElem *objPtr =
3526 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
3529 defaultAllocator, objPtr);
3531 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
3548 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
3553#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 0
3554template <
class ELEMENT_TYPE>
3556ManagedPtr<ELEMENT_TYPE>
3563 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3566 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3570#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 1
3571template <
class ELEMENT_TYPE,
class ARGS_01>
3573ManagedPtr<ELEMENT_TYPE>
3581 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3585 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3589#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 2
3590template <
class ELEMENT_TYPE,
class ARGS_01,
3593ManagedPtr<ELEMENT_TYPE>
3602 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3607 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3611#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 3
3612template <
class ELEMENT_TYPE,
class ARGS_01,
3616ManagedPtr<ELEMENT_TYPE>
3626 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3632 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3636#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 4
3637template <
class ELEMENT_TYPE,
class ARGS_01,
3642ManagedPtr<ELEMENT_TYPE>
3653 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3660 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3664#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 5
3665template <
class ELEMENT_TYPE,
class ARGS_01,
3671ManagedPtr<ELEMENT_TYPE>
3683 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3691 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3695#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 6
3696template <
class ELEMENT_TYPE,
class ARGS_01,
3703ManagedPtr<ELEMENT_TYPE>
3716 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3725 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3729#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 7
3730template <
class ELEMENT_TYPE,
class ARGS_01,
3738ManagedPtr<ELEMENT_TYPE>
3752 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3762 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3766#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 8
3767template <
class ELEMENT_TYPE,
class ARGS_01,
3776ManagedPtr<ELEMENT_TYPE>
3791 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3802 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3806#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 9
3807template <
class ELEMENT_TYPE,
class ARGS_01,
3817ManagedPtr<ELEMENT_TYPE>
3833 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3845 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3849#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 10
3850template <
class ELEMENT_TYPE,
class ARGS_01,
3861ManagedPtr<ELEMENT_TYPE>
3878 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3891 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3895#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 11
3896template <
class ELEMENT_TYPE,
class ARGS_01,
3908ManagedPtr<ELEMENT_TYPE>
3926 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3940 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3944#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 12
3945template <
class ELEMENT_TYPE,
class ARGS_01,
3958ManagedPtr<ELEMENT_TYPE>
3977 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
3992 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
3996#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 13
3997template <
class ELEMENT_TYPE,
class ARGS_01,
4011ManagedPtr<ELEMENT_TYPE>
4031 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
4047 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
4051#if BSLMA_MANAGEDPTR_VARIADIC_LIMIT_B >= 14
4052template <
class ELEMENT_TYPE,
class ARGS_01,
4067ManagedPtr<ELEMENT_TYPE>
4088 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
4105 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
4113template <
class ELEMENT_TYPE,
class ALLOCATOR,
class... ARGS>
4116 ManagedPtr<ELEMENT_TYPE> >::type
4117ManagedPtrUtil::allocateManaged(
const ALLOCATOR& allocator,
4120 return allocateManaged<ELEMENT_TYPE>(
4121 allocator.mechanism(),
4125template <
class ELEMENT_TYPE,
class... ARGS>
4127ManagedPtr<ELEMENT_TYPE> ManagedPtrUtil::makeManaged(
4134 UnqualElem *objPtr =
4135 bslma::AllocatorUtil::allocateObject<UnqualElem>(defaultAllocator);
4138 defaultAllocator, objPtr);
4140 ::new (ManagedPtr_ImpUtil::voidify(objPtr)) ELEMENT_TYPE(
4144 return ManagedPtr<ELEMENT_TYPE>(objPtr, defaultAllocator);
4147template <
class ELEMENT_TYPE,
class... ARGS>
4149ManagedPtr<ELEMENT_TYPE>
4157 ELEMENT_TYPE *objPtr = bslma::AllocatorUtil::newObject<UnqualElem>(
4161 return ManagedPtr<ELEMENT_TYPE>(objPtr, allocator);
4172template <
class TARGET_TYPE>
4174void ManagedPtrNilDeleter<TARGET_TYPE>::deleter(
void *,
void *)
4183template <
class MANAGED_TYPE>
4185void ManagedPtr_DefaultDeleter<MANAGED_TYPE>::deleter(
void *ptr,
void *)
4187 delete reinterpret_cast<MANAGED_TYPE *
>(ptr);
4198template <
class TARGET_TYPE>
4203template <
class TARGET_TYPE>
4213template <
class TARGET_TYPE>
4214struct is_nothrow_move_constructible<
4222# error Not valid except when included from bslma_managedptr.h
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