11#ifndef INCLUDED_BSLSTL_FUNCTION_CPP03
12#define INCLUDED_BSLSTL_FUNCTION_CPP03
63#ifdef COMPILING_BSLSTL_FUNCTION_H
66#ifdef BSLS_ASSERTIMPUTIL_AVOID_STRING_CONSTANTS
68extern const char s_bslstl_function_h[];
69#undef BSLS_ASSERTIMPUTIL_FILE
70#define BSLS_ASSERTIMPUTIL_FILE BloombergLP::s_bslstl_function_h
78template <
class PROTOTYPE>
85#ifndef BDE_OMIT_INTERNAL_DEPRECATED
93template <
class PROTOTYPE>
117template <
class PROTOTYPE>
118struct Function_ArgTypes {
124template <
class RET,
class ARG>
125struct Function_ArgTypes<RET(ARG)> {
129 "deprecated_cpp17_standard_library_features",
133 typedef ARG argument_type;
139template <class RET, class ARG1, class ARG2>
140struct Function_ArgTypes<RET(ARG1, ARG2)> {
144 "deprecated_cpp17_standard_library_features",
148 typedef ARG1 first_argument_type;
151 "deprecated_cpp17_standard_library_features",
155 typedef ARG2 second_argument_type;
162#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
165#ifndef BSLSTL_FUNCTION_VARIADIC_LIMIT
166#define BSLSTL_FUNCTION_VARIADIC_LIMIT 13
168#ifndef BSLSTL_FUNCTION_VARIADIC_LIMIT_A
169#define BSLSTL_FUNCTION_VARIADIC_LIMIT_A BSLSTL_FUNCTION_VARIADIC_LIMIT
172template <
class PROTOTYPE>
173class Function_Variadic;
175#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 0
177class Function_Variadic<RET()> :
public Function_ArgTypes<RET()>
182 typedef RET Invoker(
const Function_Rep *);
196 typedef RET result_type;
197 typedef Function_Rep::allocator_type allocator_type;
200 Function_Variadic(
const allocator_type& allocator);
204 RET operator()()
const;
208#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 1
209template <
class RET,
class ARGS_01>
210class Function_Variadic<RET(ARGS_01)> :
public Function_ArgTypes<RET(ARGS_01)>
215 typedef RET Invoker(
const Function_Rep *,
230 typedef RET result_type;
231 typedef Function_Rep::allocator_type allocator_type;
234 Function_Variadic(
const allocator_type& allocator);
238 RET operator()(ARGS_01 args_01)
const;
242#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 2
243template <
class RET,
class ARGS_01,
245class Function_Variadic<RET(ARGS_01,
246 ARGS_02)> :
public Function_ArgTypes<RET(ARGS_01,
252 typedef RET Invoker(
const Function_Rep *,
269 typedef RET result_type;
270 typedef Function_Rep::allocator_type allocator_type;
273 Function_Variadic(
const allocator_type& allocator);
277 RET operator()(ARGS_01 args_01,
278 ARGS_02 args_02)
const;
282#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 3
283template <
class RET,
class ARGS_01,
286class Function_Variadic<RET(ARGS_01,
288 ARGS_03)> :
public Function_ArgTypes<RET(ARGS_01,
295 typedef RET Invoker(
const Function_Rep *,
314 typedef RET result_type;
315 typedef Function_Rep::allocator_type allocator_type;
318 Function_Variadic(
const allocator_type& allocator);
322 RET operator()(ARGS_01 args_01,
324 ARGS_03 args_03)
const;
328#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 4
329template <
class RET,
class ARGS_01,
333class Function_Variadic<RET(ARGS_01,
336 ARGS_04)> :
public Function_ArgTypes<RET(ARGS_01,
344 typedef RET Invoker(
const Function_Rep *,
365 typedef RET result_type;
366 typedef Function_Rep::allocator_type allocator_type;
369 Function_Variadic(
const allocator_type& allocator);
373 RET operator()(ARGS_01 args_01,
376 ARGS_04 args_04)
const;
380#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 5
381template <
class RET,
class ARGS_01,
386class Function_Variadic<RET(ARGS_01,
390 ARGS_05)> :
public Function_ArgTypes<RET(ARGS_01,
399 typedef RET Invoker(
const Function_Rep *,
422 typedef RET result_type;
423 typedef Function_Rep::allocator_type allocator_type;
426 Function_Variadic(
const allocator_type& allocator);
430 RET operator()(ARGS_01 args_01,
434 ARGS_05 args_05)
const;
438#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 6
439template <
class RET,
class ARGS_01,
445class Function_Variadic<RET(ARGS_01,
450 ARGS_06)> :
public Function_ArgTypes<RET(ARGS_01,
460 typedef RET Invoker(
const Function_Rep *,
485 typedef RET result_type;
486 typedef Function_Rep::allocator_type allocator_type;
489 Function_Variadic(
const allocator_type& allocator);
493 RET operator()(ARGS_01 args_01,
498 ARGS_06 args_06)
const;
502#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 7
503template <
class RET,
class ARGS_01,
510class Function_Variadic<RET(ARGS_01,
516 ARGS_07)> :
public Function_ArgTypes<RET(ARGS_01,
527 typedef RET Invoker(
const Function_Rep *,
554 typedef RET result_type;
555 typedef Function_Rep::allocator_type allocator_type;
558 Function_Variadic(
const allocator_type& allocator);
562 RET operator()(ARGS_01 args_01,
568 ARGS_07 args_07)
const;
572#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 8
573template <
class RET,
class ARGS_01,
581class Function_Variadic<RET(ARGS_01,
588 ARGS_08)> :
public Function_ArgTypes<RET(ARGS_01,
600 typedef RET Invoker(
const Function_Rep *,
629 typedef RET result_type;
630 typedef Function_Rep::allocator_type allocator_type;
633 Function_Variadic(
const allocator_type& allocator);
637 RET operator()(ARGS_01 args_01,
644 ARGS_08 args_08)
const;
648#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 9
649template <
class RET,
class ARGS_01,
658class Function_Variadic<RET(ARGS_01,
666 ARGS_09)> :
public Function_ArgTypes<RET(ARGS_01,
679 typedef RET Invoker(
const Function_Rep *,
710 typedef RET result_type;
711 typedef Function_Rep::allocator_type allocator_type;
714 Function_Variadic(
const allocator_type& allocator);
718 RET operator()(ARGS_01 args_01,
726 ARGS_09 args_09)
const;
730#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 10
731template <
class RET,
class ARGS_01,
741class Function_Variadic<RET(ARGS_01,
750 ARGS_10)> :
public Function_ArgTypes<RET(ARGS_01,
764 typedef RET Invoker(
const Function_Rep *,
797 typedef RET result_type;
798 typedef Function_Rep::allocator_type allocator_type;
801 Function_Variadic(
const allocator_type& allocator);
805 RET operator()(ARGS_01 args_01,
814 ARGS_10 args_10)
const;
818#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 11
819template <
class RET,
class ARGS_01,
830class Function_Variadic<RET(ARGS_01,
840 ARGS_11)> :
public Function_ArgTypes<RET(ARGS_01,
855 typedef RET Invoker(
const Function_Rep *,
890 typedef RET result_type;
891 typedef Function_Rep::allocator_type allocator_type;
894 Function_Variadic(
const allocator_type& allocator);
898 RET operator()(ARGS_01 args_01,
908 ARGS_11 args_11)
const;
912#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 12
913template <
class RET,
class ARGS_01,
925class Function_Variadic<RET(ARGS_01,
936 ARGS_12)> :
public Function_ArgTypes<RET(ARGS_01,
952 typedef RET Invoker(
const Function_Rep *,
989 typedef RET result_type;
990 typedef Function_Rep::allocator_type allocator_type;
993 Function_Variadic(
const allocator_type& allocator);
997 RET operator()(ARGS_01 args_01,
1008 ARGS_12 args_12)
const;
1012#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 13
1013template <
class RET,
class ARGS_01,
1026class Function_Variadic<RET(ARGS_01,
1038 ARGS_13)> :
public Function_ArgTypes<RET(ARGS_01,
1055 typedef RET Invoker(
const Function_Rep *,
1094 typedef RET result_type;
1095 typedef Function_Rep::allocator_type allocator_type;
1098 Function_Variadic(
const allocator_type& allocator);
1102 RET operator()(ARGS_01 args_01,
1114 ARGS_13 args_13)
const;
1122template <
class PROTOTYPE>
1123class Function_Variadic;
1125template <
class RET,
class... ARGS>
1126class Function_Variadic<RET(ARGS...)> :
public Function_ArgTypes<RET(ARGS...)>
1131 typedef RET Invoker(
const Function_Rep *,
1146 typedef RET result_type;
1147 typedef Function_Rep::allocator_type allocator_type;
1150 Function_Variadic(
const allocator_type& allocator);
1154 RET operator()(ARGS... args)
const;
1179template <
class PROTOTYPE,
class FUNC>
1180struct Function_IsInvocableWithPrototype;
1219template <
class PROTOTYPE>
1220class function :
public BloombergLP::bslstl::Function_Variadic<PROTOTYPE> {
1224 typedef BloombergLP::bslstl::Function_Variadic<PROTOTYPE> Base;
1225 typedef BloombergLP::bslstl::Function_Rep Function_Rep;
1226 typedef BloombergLP::bslmf::MovableRefUtil MovableRefUtil;
1231 template <
class FROM,
class TO>
1232 struct IsReferenceCompatible
1233 : BloombergLP::bslstl::Function_IsReferenceCompatible<FROM, TO>::type {
1239 template <
class TYPE>
1240 struct Decay : MovableRefUtil::Decay<TYPE> {
1247 template <
class FUNC>
1248 struct IsInvocableWithPrototype
1249 : BloombergLP::bslstl::Function_IsInvocableWithPrototype<PROTOTYPE, FUNC> {
1252#ifndef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
1258 typedef BloombergLP::bsls::UnspecifiedBool<function> UnspecifiedBoolUtil;
1259 typedef typename UnspecifiedBoolUtil::BoolType UnspecifiedBool;
1280 template <
class FUNC>
1286 BloombergLP::bslma::UsesBslmaAllocator);
1288 BloombergLP::bslmf::UsesAllocatorArgT);
1293 typedef Function_Rep::allocator_type allocator_type;
1298 function(allocator_arg_t ,
1304 function(allocator_arg_t ,
1305 const allocator_type& allocator,
1323 template <class FUNC>
1326 ! IsReferenceCompatible<typename Decay<FUNC>::type,
1328 && IsInvocableWithPrototype<
1329 typename Decay<FUNC>::type>::value
1330#ifndef BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES
1331 && ! MovableRefUtil::IsMovableReference<FUNC>::value
1333#ifdef BSLS_PLATFORM_CMP_IBM
1334 && ! is_function<FUNC>::value
1337 : Base(allocator_type())
1361#ifdef BSLS_PLATFORM_CMP_IBM
1362 template <
class FUNC>
1363 function(FUNC *func,
1364 typename enable_if<is_function<FUNC>::value,
int>::type = 0)
1366 : Base(allocator_type())
1387#ifndef BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES
1419 template <
class FUNC>
1420 explicit function(
const BloombergLP::bslmf::MovableRef<FUNC>& func,
1422 ! IsReferenceCompatible<
typename Decay<FUNC>::type,
1424 && IsInvocableWithPrototype<
1425 typename Decay<FUNC>::type>::value
1427 : Base(allocator_type())
1434 installFunc(BloombergLP::bslmf::MovableRefUtil::move(func));
1454 template <
class FUNC>
1455 function(allocator_arg_t,
1456 const allocator_type& allocator,
1459 ! IsReferenceCompatible<
typename Decay<FUNC>::type,
1461 && IsInvocableWithPrototype<
1462 typename Decay<FUNC>::type>::value
1463#ifdef BSLS_PLATFORM_CMP_IBM
1464 && ! is_function<FUNC>::value
1491#ifdef BSLS_PLATFORM_CMP_IBM
1492 template <
class FUNC>
1493 function(allocator_arg_t,
1494 const allocator_type& allocator,
1496 typename enable_if<is_function<FUNC>::value,
int>::type = 0)
1518 function(
const function& original);
1523 function(allocator_arg_t ,
1524 const allocator_type& allocator,
1525 const function& original);
1534 function(BloombergLP::bslmf::MovableRef<function> original)
1543 function(allocator_arg_t ,
1544 const allocator_type& allocator,
1545 BloombergLP::bslmf::MovableRef<function> original);
1556 function& operator=(
const function& rhs);
1566 function& operator=(BloombergLP::bslmf::MovableRef<function> rhs);
1580 template <
class FUNC>
1582 ! IsReferenceCompatible<typename Decay<FUNC>::type, function>::value
1583 && IsInvocableWithPrototype<typename Decay<FUNC>::type>::value
1592 function(allocator_arg, this->get_allocator(),
1597#ifdef BSLS_PLATFORM_CMP_IBM
1602 template <
class FUNC>
1603 typename enable_if<is_function<FUNC>::value, function&>::type
1604 operator=(FUNC *rhs)
1615 function(allocator_arg, this->get_allocator(), rhs).swap(*
this);
1626 template <
class FUNC>
1628 IsInvocableWithPrototype<typename Decay<FUNC>::type>::value
1637 function(allocator_arg, this->get_allocator(), rhs).swap(*
this);
1651 using Base::operator();
1664#ifdef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
1681 return UnspecifiedBoolUtil::makeValue(0 != this->d_rep.invoker());
1698#ifndef BDE_OMIT_INTERNAL_DEPRECATED
1713 operator const BloombergLP::bdef_Function<PROTOTYPE *>&()
const
1734#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1739template<
class RET,
class... ARGS>
1740function(RET(*)(ARGS...)) -> function<RET(ARGS...)>;
1744template<
class ALLOC,
class RET,
class... ARGS>
1745function(allocator_arg_t, ALLOC, RET(*)(ARGS...)) -> function<RET(ARGS...)>;
1751struct FunctionDeductionHelper {
1755 template<
class FUNCTOR>
1756 struct StripSignature {};
1758 template<
class RET,
class FUNCTOR,
class ...ARGS>
1759 struct StripSignature<RET (FUNCTOR::*) (ARGS...)>
1760 {
using Sig = RET(ARGS...); };
1762 template<
class RET,
class FUNCTOR,
class ...ARGS>
1763 struct StripSignature<RET (FUNCTOR::*) (ARGS...) const>
1764 {
using Sig = RET(ARGS...); };
1766 template<
class RET,
class FUNCTOR,
class ...ARGS>
1767 struct StripSignature<RET (FUNCTOR::*) (ARGS...) noexcept>
1768 {
using Sig = RET(ARGS...); };
1770 template<
class RET,
class FUNCTOR,
class ...ARGS>
1771 struct StripSignature<RET (FUNCTOR::*) (ARGS...) const noexcept>
1772 {
using Sig = RET(ARGS...); };
1774 template<
class RET,
class FUNCTOR,
class ...ARGS>
1775 struct StripSignature<RET (FUNCTOR::*) (ARGS...) &>
1776 {
using Sig = RET(ARGS...); };
1778 template<
class RET,
class FUNCTOR,
class ...ARGS>
1779 struct StripSignature<RET (FUNCTOR::*) (ARGS...) const &>
1780 {
using Sig = RET(ARGS...); };
1782 template<
class RET,
class FUNCTOR,
class ...ARGS>
1783 struct StripSignature<RET (FUNCTOR::*) (ARGS...) & noexcept>
1784 {
using Sig = RET(ARGS...); };
1786 template<
class RET,
class FUNCTOR,
class ...ARGS>
1787 struct StripSignature<RET (FUNCTOR::*) (ARGS...) const & noexcept>
1788 {
using Sig = RET(ARGS...); };
1795 class PROTOTYPE =
typename
1796 FunctionDeductionHelper::StripSignature<
decltype(&FP::operator())>::Sig
1798function(FP) -> function<PROTOTYPE>;
1805 class PROTOTYPE =
typename
1806 FunctionDeductionHelper::StripSignature<
decltype(&FP::operator())>::Sig
1808function(allocator_arg_t, ALLOC, FP) -> function<PROTOTYPE>;
1812template <
class PROTOTYPE>
1816template <
class PROTOTYPE>
1819template <
class PROTOTYPE>
1823template <
class PROTOTYPE>
1829template <
class PROTOTYPE>
1840#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1843#ifndef BSLSTL_FUNCTION_VARIADIC_LIMIT
1844#define BSLSTL_FUNCTION_VARIADIC_LIMIT 13
1846#ifndef BSLSTL_FUNCTION_VARIADIC_LIMIT_B
1847#define BSLSTL_FUNCTION_VARIADIC_LIMIT_B BSLSTL_FUNCTION_VARIADIC_LIMIT
1851#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 0
1855Function_Variadic(
const allocator_type& allocator)
1861#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 1
1862template <
class RET,
class ARGS_01>
1865Function_Variadic(
const allocator_type& allocator)
1871#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 2
1872template <
class RET,
class ARGS_01,
1877Function_Variadic(
const allocator_type& allocator)
1883#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 3
1884template <
class RET,
class ARGS_01,
1891Function_Variadic(
const allocator_type& allocator)
1897#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 4
1898template <
class RET,
class ARGS_01,
1907Function_Variadic(
const allocator_type& allocator)
1913#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 5
1914template <
class RET,
class ARGS_01,
1925Function_Variadic(
const allocator_type& allocator)
1931#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 6
1932template <
class RET,
class ARGS_01,
1945Function_Variadic(
const allocator_type& allocator)
1951#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 7
1952template <
class RET,
class ARGS_01,
1967Function_Variadic(
const allocator_type& allocator)
1973#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 8
1974template <
class RET,
class ARGS_01,
1991Function_Variadic(
const allocator_type& allocator)
1997#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 9
1998template <
class RET,
class ARGS_01,
2017Function_Variadic(
const allocator_type& allocator)
2023#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 10
2024template <
class RET,
class ARGS_01,
2045Function_Variadic(
const allocator_type& allocator)
2051#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 11
2052template <
class RET,
class ARGS_01,
2075Function_Variadic(
const allocator_type& allocator)
2081#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 12
2082template <
class RET,
class ARGS_01,
2107Function_Variadic(
const allocator_type& allocator)
2113#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 13
2114template <
class RET,
class ARGS_01,
2141Function_Variadic(
const allocator_type& allocator)
2148#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 0
2153 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2155#ifdef BDE_BUILD_TARGET_EXC
2157 throw bsl::bad_function_call();
2163 return invoker_p(&d_rep);
2167#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 1
2168template <
class RET,
class ARGS_01>
2172 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2174#ifdef BDE_BUILD_TARGET_EXC
2176 throw bsl::bad_function_call();
2182 return invoker_p(&d_rep, args_01);
2186#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 2
2187template <
class RET,
class ARGS_01,
2191 ARGS_02)>::operator()(ARGS_01 args_01,
2192 ARGS_02 args_02)
const
2194 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2196#ifdef BDE_BUILD_TARGET_EXC
2198 throw bsl::bad_function_call();
2204 return invoker_p(&d_rep, args_01,
2209#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 3
2210template <
class RET,
class ARGS_01,
2216 ARGS_03)>::operator()(ARGS_01 args_01,
2218 ARGS_03 args_03)
const
2220 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2222#ifdef BDE_BUILD_TARGET_EXC
2224 throw bsl::bad_function_call();
2230 return invoker_p(&d_rep, args_01,
2236#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 4
2237template <
class RET,
class ARGS_01,
2245 ARGS_04)>::operator()(ARGS_01 args_01,
2248 ARGS_04 args_04)
const
2250 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2252#ifdef BDE_BUILD_TARGET_EXC
2254 throw bsl::bad_function_call();
2260 return invoker_p(&d_rep, args_01,
2267#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 5
2268template <
class RET,
class ARGS_01,
2278 ARGS_05)>::operator()(ARGS_01 args_01,
2282 ARGS_05 args_05)
const
2284 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2286#ifdef BDE_BUILD_TARGET_EXC
2288 throw bsl::bad_function_call();
2294 return invoker_p(&d_rep, args_01,
2302#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 6
2303template <
class RET,
class ARGS_01,
2315 ARGS_06)>::operator()(ARGS_01 args_01,
2320 ARGS_06 args_06)
const
2322 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2324#ifdef BDE_BUILD_TARGET_EXC
2326 throw bsl::bad_function_call();
2332 return invoker_p(&d_rep, args_01,
2341#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 7
2342template <
class RET,
class ARGS_01,
2356 ARGS_07)>::operator()(ARGS_01 args_01,
2362 ARGS_07 args_07)
const
2364 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2366#ifdef BDE_BUILD_TARGET_EXC
2368 throw bsl::bad_function_call();
2374 return invoker_p(&d_rep, args_01,
2384#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 8
2385template <
class RET,
class ARGS_01,
2401 ARGS_08)>::operator()(ARGS_01 args_01,
2408 ARGS_08 args_08)
const
2410 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2412#ifdef BDE_BUILD_TARGET_EXC
2414 throw bsl::bad_function_call();
2420 return invoker_p(&d_rep, args_01,
2431#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 9
2432template <
class RET,
class ARGS_01,
2450 ARGS_09)>::operator()(ARGS_01 args_01,
2458 ARGS_09 args_09)
const
2460 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2462#ifdef BDE_BUILD_TARGET_EXC
2464 throw bsl::bad_function_call();
2470 return invoker_p(&d_rep, args_01,
2482#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 10
2483template <
class RET,
class ARGS_01,
2503 ARGS_10)>::operator()(ARGS_01 args_01,
2512 ARGS_10 args_10)
const
2514 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2516#ifdef BDE_BUILD_TARGET_EXC
2518 throw bsl::bad_function_call();
2524 return invoker_p(&d_rep, args_01,
2537#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 11
2538template <
class RET,
class ARGS_01,
2560 ARGS_11)>::operator()(ARGS_01 args_01,
2570 ARGS_11 args_11)
const
2572 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2574#ifdef BDE_BUILD_TARGET_EXC
2576 throw bsl::bad_function_call();
2582 return invoker_p(&d_rep, args_01,
2596#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 12
2597template <
class RET,
class ARGS_01,
2621 ARGS_12)>::operator()(ARGS_01 args_01,
2632 ARGS_12 args_12)
const
2634 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2636#ifdef BDE_BUILD_TARGET_EXC
2638 throw bsl::bad_function_call();
2644 return invoker_p(&d_rep, args_01,
2659#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 13
2660template <
class RET,
class ARGS_01,
2686 ARGS_13)>::operator()(ARGS_01 args_01,
2698 ARGS_13 args_13)
const
2700 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2702#ifdef BDE_BUILD_TARGET_EXC
2704 throw bsl::bad_function_call();
2710 return invoker_p(&d_rep, args_01,
2731template <
class RET,
class... ARGS>
2734Function_Variadic(
const allocator_type& allocator)
2739template <
class RET,
class... ARGS>
2743 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2745#ifdef BDE_BUILD_TARGET_EXC
2747 throw bsl::bad_function_call();
2753 return invoker_p(&d_rep, args...);
2761#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
2764#ifndef BSLSTL_FUNCTION_VARIADIC_LIMIT
2765#define BSLSTL_FUNCTION_VARIADIC_LIMIT 13
2767#ifndef BSLSTL_FUNCTION_VARIADIC_LIMIT_C
2768#define BSLSTL_FUNCTION_VARIADIC_LIMIT_C BSLSTL_FUNCTION_VARIADIC_LIMIT
2772#ifdef BSLSTL_FUNCTION_INVOKERUTIL_SUPPORT_IS_FUNC_INVOCABLE
2774#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 0
2775template <
class RET,
class FUNC>
2776struct Function_IsInvocableWithPrototype<RET(), FUNC>
2777: Function_InvokerUtil::IsFuncInvocable<RET(), FUNC> {
2781#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 1
2782template <
class RET,
class FUNC,
class ARGS_01>
2783struct Function_IsInvocableWithPrototype<RET(ARGS_01), FUNC>
2784: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01), FUNC> {
2788#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 2
2789template <
class RET,
class FUNC,
class ARGS_01,
2791struct Function_IsInvocableWithPrototype<RET(ARGS_01,
2793: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
2798#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 3
2799template <
class RET,
class FUNC,
class ARGS_01,
2802struct Function_IsInvocableWithPrototype<RET(ARGS_01,
2805: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
2811#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 4
2812template <
class RET,
class FUNC,
class ARGS_01,
2816struct Function_IsInvocableWithPrototype<RET(ARGS_01,
2820: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
2827#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 5
2828template <
class RET,
class FUNC,
class ARGS_01,
2833struct Function_IsInvocableWithPrototype<RET(ARGS_01,
2838: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
2846#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 6
2847template <
class RET,
class FUNC,
class ARGS_01,
2853struct Function_IsInvocableWithPrototype<RET(ARGS_01,
2859: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
2868#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 7
2869template <
class RET,
class FUNC,
class ARGS_01,
2876struct Function_IsInvocableWithPrototype<RET(ARGS_01,
2883: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
2893#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 8
2894template <
class RET,
class FUNC,
class ARGS_01,
2902struct Function_IsInvocableWithPrototype<RET(ARGS_01,
2910: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
2921#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 9
2922template <
class RET,
class FUNC,
class ARGS_01,
2931struct Function_IsInvocableWithPrototype<RET(ARGS_01,
2940: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
2952#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 10
2953template <
class RET,
class FUNC,
class ARGS_01,
2963struct Function_IsInvocableWithPrototype<RET(ARGS_01,
2973: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
2986#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 11
2987template <
class RET,
class FUNC,
class ARGS_01,
2998struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3009: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
3023#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 12
3024template <
class RET,
class FUNC,
class ARGS_01,
3036struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3048: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
3063#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 13
3064template <
class RET,
class FUNC,
class ARGS_01,
3077struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3090: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
3109#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 0
3110template <
class RET,
class FUNC>
3111struct Function_IsInvocableWithPrototype<RET(), FUNC>
3116#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 1
3117template <
class RET,
class FUNC,
class ARGS_01>
3118struct Function_IsInvocableWithPrototype<RET(ARGS_01), FUNC>
3123#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 2
3124template <
class RET,
class FUNC,
class ARGS_01,
3126struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3132#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 3
3133template <
class RET,
class FUNC,
class ARGS_01,
3136struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3143#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 4
3144template <
class RET,
class FUNC,
class ARGS_01,
3148struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3156#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 5
3157template <
class RET,
class FUNC,
class ARGS_01,
3162struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3171#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 6
3172template <
class RET,
class FUNC,
class ARGS_01,
3178struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3188#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 7
3189template <
class RET,
class FUNC,
class ARGS_01,
3196struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3207#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 8
3208template <
class RET,
class FUNC,
class ARGS_01,
3216struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3228#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 9
3229template <
class RET,
class FUNC,
class ARGS_01,
3238struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3251#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 10
3252template <
class RET,
class FUNC,
class ARGS_01,
3262struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3276#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 11
3277template <
class RET,
class FUNC,
class ARGS_01,
3288struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3303#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 12
3304template <
class RET,
class FUNC,
class ARGS_01,
3316struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3332#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 13
3333template <
class RET,
class FUNC,
class ARGS_01,
3346struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3370#ifdef BSLSTL_FUNCTION_INVOKERUTIL_SUPPORT_IS_FUNC_INVOCABLE
3372template <
class RET,
class FUNC,
class... ARGS>
3373struct Function_IsInvocableWithPrototype<RET(ARGS...), FUNC>
3374: Function_InvokerUtil::IsFuncInvocable<RET(ARGS...), FUNC> {
3379template <
class RET,
class FUNC,
class... ARGS>
3380struct Function_IsInvocableWithPrototype<RET(ARGS...), FUNC>
3396template <
class PROTOTYPE>
3397template <
class FUNC>
3402 typedef BloombergLP::bslstl::Function_InvokerUtil InvokerUtil;
3403 typedef InvokerUtil::GenericInvoker GenericInvoker;
3404 typedef typename Decay<FUNC>::type DecayedFunc;
3406 const DecayedFunc& decayedFunc = func;
3407 GenericInvoker *
const invoker =
3408 InvokerUtil::invokerForFunc<PROTOTYPE>(decayedFunc);
3415template <
class PROTOTYPE>
3417 : Base(allocator_type())
3421template <
class PROTOTYPE>
3423 : Base(allocator_type())
3427template <
class PROTOTYPE>
3430 const allocator_type& allocator)
3436template <
class PROTOTYPE>
3439 const allocator_type& allocator,
3445template <
class PROTOTYPE>
3447 : Base(allocator_type())
3449 this->d_rep.copyInit(original.d_rep);
3452template <
class PROTOTYPE>
3454 const allocator_type& allocator,
3455 const function& original)
3458 this->d_rep.copyInit(original.d_rep);
3461template <
class PROTOTYPE>
3465 : Base(MovableRefUtil::access(original).get_allocator())
3467 this->d_rep.moveInit(&MovableRefUtil::access(original).d_rep);
3470template <
class PROTOTYPE>
3473 const allocator_type& allocator,
3474 BloombergLP::bslmf::MovableRef<function> original)
3477 this->d_rep.moveInit(&MovableRefUtil::access(original).d_rep);
3481template <
class PROTOTYPE>
3485 function temp(allocator_arg, this->get_allocator(), rhs);
3486 this->d_rep.makeEmpty();
3487 this->d_rep.moveInit(&temp.d_rep);
3491template <
class PROTOTYPE>
3494 BloombergLP::bslmf::MovableRef<function> rhs)
3496 function temp(allocator_arg, this->get_allocator(),
3497 MovableRefUtil::move(rhs));
3498 this->d_rep.makeEmpty();
3499 this->d_rep.moveInit(&temp.d_rep);
3503template <
class PROTOTYPE>
3507 this->d_rep.makeEmpty();
3511template <
class PROTOTYPE>
3515 this->d_rep.
swap(other.d_rep);
3518template <
class PROTOTYPE>
3523 return this->d_rep.template target<TP>();
3528#ifdef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
3529template <
class PROTOTYPE>
3535 return 0 != this->d_rep.invoker();
3539template <
class PROTOTYPE>
3547template <
class PROTOTYPE>
3552#if defined(BSLS_PLATFORM_CMP_MSVC) && BSLS_PLATFORM_CMP_VERSION < 1900
3554 return (
const TP*) this->d_rep.target<TP>();
3556 return this->d_rep.template target<TP>();
3560template <
class PROTOTYPE>
3561const std::type_info&
3564 return this->d_rep.target_type();
3567#ifndef BDE_OMIT_INTERNAL_DEPRECATED
3569template <
class PROTOTYPE>
3574 typedef BloombergLP::bdef_Function<PROTOTYPE *> Ret;
3575 return *
static_cast<Ret*
>(
this);
3578template <
class PROTOTYPE>
3581operator
const BloombergLP::bdef_Function<PROTOTYPE *>&()
const
3584 typedef const BloombergLP::bdef_Function<PROTOTYPE *> Ret;
3585 return *
static_cast<Ret*
>(
this);
3588template <
class PROTOTYPE>
3590BloombergLP::bslma::Allocator *
3593 return get_allocator().mechanism();
3596template <
class PROTOTYPE>
3605template <
class PROTOTYPE>
3613template <
class PROTOTYPE>
3621template <
class PROTOTYPE>
3629template <
class PROTOTYPE>
3637template <
class PROTOTYPE>
3654template <
class PROTO>
3655struct Function_InvokerUtilNullCheck<
bsl::function<PROTO> > {
3671#ifdef BSLS_ASSERTIMPUTIL_AVOID_STRING_CONSTANTS
3672#undef BSLS_ASSERTIMPUTIL_FILE
3673#define BSLS_ASSERTIMPUTIL_FILE BSLS_ASSERTIMPUTIL_DEFAULTFILE
3677# error Not valid except when included from bslstl_function.h
#define BSLMF_NESTED_TRAIT_DECLARATION(t_TYPE, t_TRAIT)
Definition bslmf_nestedtraitdeclaration.h:231
Definition bslstl_function.h:731
Forward declaration.
Definition bslstl_function.h:934
Function_Rep::allocator_type allocator_type
Definition bslstl_function.h:1007
Imp::Type Type
Definition bslmf_forwardingtype.h:439
Definition bslstl_function_rep.h:132
Definition bslstl_function.h:802
#define BSLS_ASSERT_OPT(X)
Definition bsls_assert.h:1856
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2012
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2018
#define BSLS_DEPRECATE_FEATURE(UOR, FEATURE, MESSAGE)
Definition bsls_deprecatefeature.h:319
#define BSLS_KEYWORD_DELETED
Definition bsls_keyword.h:609
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:632
BloombergLP::bslma::Allocator * allocator() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_function.h:1846
function & operator=(const function &rhs)
Definition bslstl_function.h:1738
allocator_type get_allocator() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_function.h:1797
const std::type_info & target_type() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_function.h:1817
bool isInplace() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_function.h:1853
void swap(function &other) BSLS_KEYWORD_NOEXCEPT
Definition bslstl_function.h:1768
TP * target() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_function.h:1776
function() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_function.h:1671
bool operator!=(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
bool operator==(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
void swap(OptionValue &a, OptionValue &b)
Definition bdlb_printmethods.h:283
BloombergLP::bsls::Nullptr_Impl::Type nullptr_t
Definition bsls_nullptr.h:281
void swap(array< VALUE_TYPE, SIZE > &lhs, array< VALUE_TYPE, SIZE > &rhs)
bool operator==(const memory_resource &a, const memory_resource &b)
bool operator!=(const memory_resource &a, const memory_resource &b)
Definition bslstl_algorithm.h:82
Definition bdldfp_decimal.h:5188
Definition bslmf_integralconstant.h:244
Definition bslmf_isnothrowmoveconstructible.h:358
static bool isNull(const FUNC &)
Return false.
Definition bslstl_function_invokerutil.h:803