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>
119template <
class PROTOTYPE>
120struct Function_ArgTypes {
126template <
class RET,
class ARG>
127struct Function_ArgTypes<RET(ARG)> {
134 "deprecated_cpp17_standard_library_features",
136 typedef ARG argument_type;
142template <class RET, class ARG1, class ARG2>
143struct Function_ArgTypes<RET(ARG1, ARG2)> {
150 "deprecated_cpp17_standard_library_features",
152 typedef ARG1 first_argument_type;
155 "deprecated_cpp17_standard_library_features",
159 typedef ARG2 second_argument_type;
166#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
169#ifndef BSLSTL_FUNCTION_VARIADIC_LIMIT
170#define BSLSTL_FUNCTION_VARIADIC_LIMIT 13
172#ifndef BSLSTL_FUNCTION_VARIADIC_LIMIT_A
173#define BSLSTL_FUNCTION_VARIADIC_LIMIT_A BSLSTL_FUNCTION_VARIADIC_LIMIT
176template <
class PROTOTYPE>
177class Function_Variadic;
179#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 0
181class Function_Variadic<RET()> :
public Function_ArgTypes<RET()>
186 typedef RET Invoker(
const Function_Rep *);
200 typedef RET result_type;
201 typedef Function_Rep::allocator_type allocator_type;
204 Function_Variadic(
const allocator_type& allocator);
208 RET operator()()
const;
212#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 1
213template <
class RET,
class ARGS_01>
214class Function_Variadic<RET(ARGS_01)> :
public Function_ArgTypes<RET(ARGS_01)>
219 typedef RET Invoker(
const Function_Rep *,
234 typedef RET result_type;
235 typedef Function_Rep::allocator_type allocator_type;
238 Function_Variadic(
const allocator_type& allocator);
242 RET operator()(ARGS_01 args_01)
const;
246#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 2
247template <
class RET,
class ARGS_01,
249class Function_Variadic<RET(ARGS_01,
250 ARGS_02)> :
public Function_ArgTypes<RET(ARGS_01,
256 typedef RET Invoker(
const Function_Rep *,
273 typedef RET result_type;
274 typedef Function_Rep::allocator_type allocator_type;
277 Function_Variadic(
const allocator_type& allocator);
281 RET operator()(ARGS_01 args_01,
282 ARGS_02 args_02)
const;
286#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 3
287template <
class RET,
class ARGS_01,
290class Function_Variadic<RET(ARGS_01,
292 ARGS_03)> :
public Function_ArgTypes<RET(ARGS_01,
299 typedef RET Invoker(
const Function_Rep *,
318 typedef RET result_type;
319 typedef Function_Rep::allocator_type allocator_type;
322 Function_Variadic(
const allocator_type& allocator);
326 RET operator()(ARGS_01 args_01,
328 ARGS_03 args_03)
const;
332#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 4
333template <
class RET,
class ARGS_01,
337class Function_Variadic<RET(ARGS_01,
340 ARGS_04)> :
public Function_ArgTypes<RET(ARGS_01,
348 typedef RET Invoker(
const Function_Rep *,
369 typedef RET result_type;
370 typedef Function_Rep::allocator_type allocator_type;
373 Function_Variadic(
const allocator_type& allocator);
377 RET operator()(ARGS_01 args_01,
380 ARGS_04 args_04)
const;
384#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 5
385template <
class RET,
class ARGS_01,
390class Function_Variadic<RET(ARGS_01,
394 ARGS_05)> :
public Function_ArgTypes<RET(ARGS_01,
403 typedef RET Invoker(
const Function_Rep *,
426 typedef RET result_type;
427 typedef Function_Rep::allocator_type allocator_type;
430 Function_Variadic(
const allocator_type& allocator);
434 RET operator()(ARGS_01 args_01,
438 ARGS_05 args_05)
const;
442#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 6
443template <
class RET,
class ARGS_01,
449class Function_Variadic<RET(ARGS_01,
454 ARGS_06)> :
public Function_ArgTypes<RET(ARGS_01,
464 typedef RET Invoker(
const Function_Rep *,
489 typedef RET result_type;
490 typedef Function_Rep::allocator_type allocator_type;
493 Function_Variadic(
const allocator_type& allocator);
497 RET operator()(ARGS_01 args_01,
502 ARGS_06 args_06)
const;
506#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 7
507template <
class RET,
class ARGS_01,
514class Function_Variadic<RET(ARGS_01,
520 ARGS_07)> :
public Function_ArgTypes<RET(ARGS_01,
531 typedef RET Invoker(
const Function_Rep *,
558 typedef RET result_type;
559 typedef Function_Rep::allocator_type allocator_type;
562 Function_Variadic(
const allocator_type& allocator);
566 RET operator()(ARGS_01 args_01,
572 ARGS_07 args_07)
const;
576#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 8
577template <
class RET,
class ARGS_01,
585class Function_Variadic<RET(ARGS_01,
592 ARGS_08)> :
public Function_ArgTypes<RET(ARGS_01,
604 typedef RET Invoker(
const Function_Rep *,
633 typedef RET result_type;
634 typedef Function_Rep::allocator_type allocator_type;
637 Function_Variadic(
const allocator_type& allocator);
641 RET operator()(ARGS_01 args_01,
648 ARGS_08 args_08)
const;
652#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 9
653template <
class RET,
class ARGS_01,
662class Function_Variadic<RET(ARGS_01,
670 ARGS_09)> :
public Function_ArgTypes<RET(ARGS_01,
683 typedef RET Invoker(
const Function_Rep *,
714 typedef RET result_type;
715 typedef Function_Rep::allocator_type allocator_type;
718 Function_Variadic(
const allocator_type& allocator);
722 RET operator()(ARGS_01 args_01,
730 ARGS_09 args_09)
const;
734#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 10
735template <
class RET,
class ARGS_01,
745class Function_Variadic<RET(ARGS_01,
754 ARGS_10)> :
public Function_ArgTypes<RET(ARGS_01,
768 typedef RET Invoker(
const Function_Rep *,
801 typedef RET result_type;
802 typedef Function_Rep::allocator_type allocator_type;
805 Function_Variadic(
const allocator_type& allocator);
809 RET operator()(ARGS_01 args_01,
818 ARGS_10 args_10)
const;
822#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 11
823template <
class RET,
class ARGS_01,
834class Function_Variadic<RET(ARGS_01,
844 ARGS_11)> :
public Function_ArgTypes<RET(ARGS_01,
859 typedef RET Invoker(
const Function_Rep *,
894 typedef RET result_type;
895 typedef Function_Rep::allocator_type allocator_type;
898 Function_Variadic(
const allocator_type& allocator);
902 RET operator()(ARGS_01 args_01,
912 ARGS_11 args_11)
const;
916#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 12
917template <
class RET,
class ARGS_01,
929class Function_Variadic<RET(ARGS_01,
940 ARGS_12)> :
public Function_ArgTypes<RET(ARGS_01,
956 typedef RET Invoker(
const Function_Rep *,
993 typedef RET result_type;
994 typedef Function_Rep::allocator_type allocator_type;
997 Function_Variadic(
const allocator_type& allocator);
1001 RET operator()(ARGS_01 args_01,
1012 ARGS_12 args_12)
const;
1016#if BSLSTL_FUNCTION_VARIADIC_LIMIT_A >= 13
1017template <
class RET,
class ARGS_01,
1030class Function_Variadic<RET(ARGS_01,
1042 ARGS_13)> :
public Function_ArgTypes<RET(ARGS_01,
1059 typedef RET Invoker(
const Function_Rep *,
1098 typedef RET result_type;
1099 typedef Function_Rep::allocator_type allocator_type;
1102 Function_Variadic(
const allocator_type& allocator);
1106 RET operator()(ARGS_01 args_01,
1118 ARGS_13 args_13)
const;
1126template <
class PROTOTYPE>
1127class Function_Variadic;
1129template <
class RET,
class... ARGS>
1130class Function_Variadic<RET(ARGS...)> :
public Function_ArgTypes<RET(ARGS...)>
1135 typedef RET Invoker(
const Function_Rep *,
1150 typedef RET result_type;
1151 typedef Function_Rep::allocator_type allocator_type;
1154 Function_Variadic(
const allocator_type& allocator);
1158 RET operator()(ARGS... args)
const;
1183template <
class PROTOTYPE,
class FUNC>
1184struct Function_IsInvocableWithPrototype;
1224template <
class PROTOTYPE>
1225class function :
public BloombergLP::bslstl::Function_Variadic<PROTOTYPE> {
1229 typedef BloombergLP::bslstl::Function_Variadic<PROTOTYPE> Base;
1230 typedef BloombergLP::bslstl::Function_Rep Function_Rep;
1231 typedef BloombergLP::bslmf::MovableRefUtil MovableRefUtil;
1236 template <
class FROM,
class TO>
1237 struct IsReferenceCompatible
1238 : BloombergLP::bslstl::Function_IsReferenceCompatible<FROM, TO>::type {
1244 template <
class TYPE>
1245 struct Decay : MovableRefUtil::Decay<TYPE> {
1252 template <
class FUNC>
1253 struct IsInvocableWithPrototype
1254 : BloombergLP::bslstl::Function_IsInvocableWithPrototype<PROTOTYPE, FUNC> {
1257#ifndef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
1263 typedef BloombergLP::bsls::UnspecifiedBool<function> UnspecifiedBoolUtil;
1264 typedef typename UnspecifiedBoolUtil::BoolType UnspecifiedBool;
1286 template <
class FUNC>
1292 BloombergLP::bslma::UsesBslmaAllocator);
1294 BloombergLP::bslmf::UsesAllocatorArgT);
1299 typedef Function_Rep::allocator_type allocator_type;
1304 function(allocator_arg_t ,
1310 function(allocator_arg_t ,
1311 const allocator_type& allocator,
1330 template <class FUNC>
1333 ! IsReferenceCompatible<typename Decay<FUNC>::type,
1335 && IsInvocableWithPrototype<
1336 typename Decay<FUNC>::type>::value
1337#ifndef BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES
1338 && ! MovableRefUtil::IsMovableReference<FUNC>::value
1340#ifdef BSLS_PLATFORM_CMP_IBM
1341 && ! is_function<FUNC>::value
1344 : Base(allocator_type())
1368#ifdef BSLS_PLATFORM_CMP_IBM
1369 template <
class FUNC>
1370 function(FUNC *func,
1371 typename enable_if<is_function<FUNC>::value,
int>::type = 0)
1373 : Base(allocator_type())
1394#ifndef BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES
1426 template <
class FUNC>
1427 explicit function(
const BloombergLP::bslmf::MovableRef<FUNC>& func,
1429 ! IsReferenceCompatible<
typename Decay<FUNC>::type,
1431 && IsInvocableWithPrototype<
1432 typename Decay<FUNC>::type>::value
1434 : Base(allocator_type())
1441 installFunc(BloombergLP::bslmf::MovableRefUtil::move(func));
1462 template <
class FUNC>
1463 function(allocator_arg_t,
1464 const allocator_type& allocator,
1467 ! IsReferenceCompatible<
typename Decay<FUNC>::type,
1469 && IsInvocableWithPrototype<
1470 typename Decay<FUNC>::type>::value
1471#ifdef BSLS_PLATFORM_CMP_IBM
1472 && ! is_function<FUNC>::value
1499#ifdef BSLS_PLATFORM_CMP_IBM
1500 template <
class FUNC>
1501 function(allocator_arg_t,
1502 const allocator_type& allocator,
1504 typename enable_if<is_function<FUNC>::value,
int>::type = 0)
1530 function(
const function& original);
1531 function(allocator_arg_t ,
1532 const allocator_type& allocator,
1533 const function& original);
1542 function(BloombergLP::bslmf::MovableRef<function> original)
1551 function(allocator_arg_t ,
1552 const allocator_type& allocator,
1553 BloombergLP::bslmf::MovableRef<function> original);
1564 function& operator=(
const function& rhs);
1575 function& operator=(BloombergLP::bslmf::MovableRef<function> rhs);
1590 template <
class FUNC>
1592 ! IsReferenceCompatible<typename Decay<FUNC>::type, function>::value
1593 && IsInvocableWithPrototype<typename Decay<FUNC>::type>::value
1602 function(allocator_arg, this->get_allocator(),
1607#ifdef BSLS_PLATFORM_CMP_IBM
1612 template <
class FUNC>
1613 typename enable_if<is_function<FUNC>::value, function&>::type
1614 operator=(FUNC *rhs)
1625 function(allocator_arg, this->get_allocator(), rhs).swap(*
this);
1637 template <
class FUNC>
1639 IsInvocableWithPrototype<typename Decay<FUNC>::type>::value
1648 function(allocator_arg, this->get_allocator(), rhs).swap(*
this);
1663 using Base::operator();
1677#ifdef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
1696 return UnspecifiedBoolUtil::makeValue(0 != this->d_rep.invoker());
1713#ifndef BDE_OMIT_INTERNAL_DEPRECATED
1730 operator const BloombergLP::bdef_Function<PROTOTYPE *>&()
const
1751#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1756template<
class RET,
class... ARGS>
1757function(RET(*)(ARGS...)) -> function<RET(ARGS...)>;
1761template<
class ALLOC,
class RET,
class... ARGS>
1762function(allocator_arg_t, ALLOC, RET(*)(ARGS...)) -> function<RET(ARGS...)>;
1770struct FunctionDeductionHelper {
1774 template<
class FUNCTOR>
1775 struct StripSignature {};
1777 template<
class RET,
class FUNCTOR,
class ...ARGS>
1778 struct StripSignature<RET (FUNCTOR::*) (ARGS...)>
1779 {
using Sig = RET(ARGS...); };
1781 template<
class RET,
class FUNCTOR,
class ...ARGS>
1782 struct StripSignature<RET (FUNCTOR::*) (ARGS...) const>
1783 {
using Sig = RET(ARGS...); };
1785 template<
class RET,
class FUNCTOR,
class ...ARGS>
1786 struct StripSignature<RET (FUNCTOR::*) (ARGS...) noexcept>
1787 {
using Sig = RET(ARGS...); };
1789 template<
class RET,
class FUNCTOR,
class ...ARGS>
1790 struct StripSignature<RET (FUNCTOR::*) (ARGS...) const noexcept>
1791 {
using Sig = RET(ARGS...); };
1793 template<
class RET,
class FUNCTOR,
class ...ARGS>
1794 struct StripSignature<RET (FUNCTOR::*) (ARGS...) &>
1795 {
using Sig = RET(ARGS...); };
1797 template<
class RET,
class FUNCTOR,
class ...ARGS>
1798 struct StripSignature<RET (FUNCTOR::*) (ARGS...) const &>
1799 {
using Sig = RET(ARGS...); };
1801 template<
class RET,
class FUNCTOR,
class ...ARGS>
1802 struct StripSignature<RET (FUNCTOR::*) (ARGS...) & noexcept>
1803 {
using Sig = RET(ARGS...); };
1805 template<
class RET,
class FUNCTOR,
class ...ARGS>
1806 struct StripSignature<RET (FUNCTOR::*) (ARGS...) const & noexcept>
1807 {
using Sig = RET(ARGS...); };
1814 class PROTOTYPE =
typename
1815 FunctionDeductionHelper::StripSignature<
decltype(&FP::operator())>::Sig
1817function(FP) -> function<PROTOTYPE>;
1824 class PROTOTYPE =
typename
1825 FunctionDeductionHelper::StripSignature<
decltype(&FP::operator())>::Sig
1827function(allocator_arg_t, ALLOC, FP) -> function<PROTOTYPE>;
1831template <
class PROTOTYPE>
1835template <
class PROTOTYPE>
1838template <
class PROTOTYPE>
1842template <
class PROTOTYPE>
1849template <
class PROTOTYPE>
1860#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1863#ifndef BSLSTL_FUNCTION_VARIADIC_LIMIT
1864#define BSLSTL_FUNCTION_VARIADIC_LIMIT 13
1866#ifndef BSLSTL_FUNCTION_VARIADIC_LIMIT_B
1867#define BSLSTL_FUNCTION_VARIADIC_LIMIT_B BSLSTL_FUNCTION_VARIADIC_LIMIT
1871#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 0
1875Function_Variadic(
const allocator_type& allocator)
1881#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 1
1882template <
class RET,
class ARGS_01>
1885Function_Variadic(
const allocator_type& allocator)
1891#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 2
1892template <
class RET,
class ARGS_01,
1897Function_Variadic(
const allocator_type& allocator)
1903#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 3
1904template <
class RET,
class ARGS_01,
1911Function_Variadic(
const allocator_type& allocator)
1917#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 4
1918template <
class RET,
class ARGS_01,
1927Function_Variadic(
const allocator_type& allocator)
1933#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 5
1934template <
class RET,
class ARGS_01,
1945Function_Variadic(
const allocator_type& allocator)
1951#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 6
1952template <
class RET,
class ARGS_01,
1965Function_Variadic(
const allocator_type& allocator)
1971#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 7
1972template <
class RET,
class ARGS_01,
1987Function_Variadic(
const allocator_type& allocator)
1993#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 8
1994template <
class RET,
class ARGS_01,
2011Function_Variadic(
const allocator_type& allocator)
2017#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 9
2018template <
class RET,
class ARGS_01,
2037Function_Variadic(
const allocator_type& allocator)
2043#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 10
2044template <
class RET,
class ARGS_01,
2065Function_Variadic(
const allocator_type& allocator)
2071#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 11
2072template <
class RET,
class ARGS_01,
2095Function_Variadic(
const allocator_type& allocator)
2101#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 12
2102template <
class RET,
class ARGS_01,
2127Function_Variadic(
const allocator_type& allocator)
2133#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 13
2134template <
class RET,
class ARGS_01,
2161Function_Variadic(
const allocator_type& allocator)
2168#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 0
2173 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2179 return invoker_p(&d_rep);
2183#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 1
2184template <
class RET,
class ARGS_01>
2188 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2194 return invoker_p(&d_rep, args_01);
2198#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 2
2199template <
class RET,
class ARGS_01,
2203 ARGS_02)>::operator()(ARGS_01 args_01,
2204 ARGS_02 args_02)
const
2206 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2212 return invoker_p(&d_rep, args_01,
2217#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 3
2218template <
class RET,
class ARGS_01,
2224 ARGS_03)>::operator()(ARGS_01 args_01,
2226 ARGS_03 args_03)
const
2228 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2234 return invoker_p(&d_rep, args_01,
2240#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 4
2241template <
class RET,
class ARGS_01,
2249 ARGS_04)>::operator()(ARGS_01 args_01,
2252 ARGS_04 args_04)
const
2254 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
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());
2290 return invoker_p(&d_rep, args_01,
2298#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 6
2299template <
class RET,
class ARGS_01,
2311 ARGS_06)>::operator()(ARGS_01 args_01,
2316 ARGS_06 args_06)
const
2318 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2324 return invoker_p(&d_rep, args_01,
2333#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 7
2334template <
class RET,
class ARGS_01,
2348 ARGS_07)>::operator()(ARGS_01 args_01,
2354 ARGS_07 args_07)
const
2356 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2362 return invoker_p(&d_rep, args_01,
2372#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 8
2373template <
class RET,
class ARGS_01,
2389 ARGS_08)>::operator()(ARGS_01 args_01,
2396 ARGS_08 args_08)
const
2398 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2404 return invoker_p(&d_rep, args_01,
2415#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 9
2416template <
class RET,
class ARGS_01,
2434 ARGS_09)>::operator()(ARGS_01 args_01,
2442 ARGS_09 args_09)
const
2444 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2450 return invoker_p(&d_rep, args_01,
2462#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 10
2463template <
class RET,
class ARGS_01,
2483 ARGS_10)>::operator()(ARGS_01 args_01,
2492 ARGS_10 args_10)
const
2494 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2500 return invoker_p(&d_rep, args_01,
2513#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 11
2514template <
class RET,
class ARGS_01,
2536 ARGS_11)>::operator()(ARGS_01 args_01,
2546 ARGS_11 args_11)
const
2548 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2554 return invoker_p(&d_rep, args_01,
2568#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 12
2569template <
class RET,
class ARGS_01,
2593 ARGS_12)>::operator()(ARGS_01 args_01,
2604 ARGS_12 args_12)
const
2606 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2612 return invoker_p(&d_rep, args_01,
2627#if BSLSTL_FUNCTION_VARIADIC_LIMIT_B >= 13
2628template <
class RET,
class ARGS_01,
2654 ARGS_13)>::operator()(ARGS_01 args_01,
2666 ARGS_13 args_13)
const
2668 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2674 return invoker_p(&d_rep, args_01,
2695template <
class RET,
class... ARGS>
2698Function_Variadic(
const allocator_type& allocator)
2703template <
class RET,
class... ARGS>
2707 Invoker *invoker_p =
reinterpret_cast<Invoker*
>(d_rep.invoker());
2713 return invoker_p(&d_rep, args...);
2721#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
2724#ifndef BSLSTL_FUNCTION_VARIADIC_LIMIT
2725#define BSLSTL_FUNCTION_VARIADIC_LIMIT 13
2727#ifndef BSLSTL_FUNCTION_VARIADIC_LIMIT_C
2728#define BSLSTL_FUNCTION_VARIADIC_LIMIT_C BSLSTL_FUNCTION_VARIADIC_LIMIT
2732#ifdef BSLSTL_FUNCTION_INVOKERUTIL_SUPPORT_IS_FUNC_INVOCABLE
2734#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 0
2735template <
class RET,
class FUNC>
2736struct Function_IsInvocableWithPrototype<RET(), FUNC>
2737: Function_InvokerUtil::IsFuncInvocable<RET(), FUNC> {
2741#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 1
2742template <
class RET,
class FUNC,
class ARGS_01>
2743struct Function_IsInvocableWithPrototype<RET(ARGS_01), FUNC>
2744: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01), FUNC> {
2748#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 2
2749template <
class RET,
class FUNC,
class ARGS_01,
2751struct Function_IsInvocableWithPrototype<RET(ARGS_01,
2753: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
2758#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 3
2759template <
class RET,
class FUNC,
class ARGS_01,
2762struct Function_IsInvocableWithPrototype<RET(ARGS_01,
2765: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
2771#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 4
2772template <
class RET,
class FUNC,
class ARGS_01,
2776struct Function_IsInvocableWithPrototype<RET(ARGS_01,
2780: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
2787#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 5
2788template <
class RET,
class FUNC,
class ARGS_01,
2793struct Function_IsInvocableWithPrototype<RET(ARGS_01,
2798: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
2806#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 6
2807template <
class RET,
class FUNC,
class ARGS_01,
2813struct Function_IsInvocableWithPrototype<RET(ARGS_01,
2819: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
2828#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 7
2829template <
class RET,
class FUNC,
class ARGS_01,
2836struct Function_IsInvocableWithPrototype<RET(ARGS_01,
2843: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
2853#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 8
2854template <
class RET,
class FUNC,
class ARGS_01,
2862struct Function_IsInvocableWithPrototype<RET(ARGS_01,
2870: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
2881#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 9
2882template <
class RET,
class FUNC,
class ARGS_01,
2891struct Function_IsInvocableWithPrototype<RET(ARGS_01,
2900: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
2912#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 10
2913template <
class RET,
class FUNC,
class ARGS_01,
2923struct Function_IsInvocableWithPrototype<RET(ARGS_01,
2933: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
2946#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 11
2947template <
class RET,
class FUNC,
class ARGS_01,
2958struct Function_IsInvocableWithPrototype<RET(ARGS_01,
2969: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
2983#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 12
2984template <
class RET,
class FUNC,
class ARGS_01,
2996struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3008: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
3023#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 13
3024template <
class RET,
class FUNC,
class ARGS_01,
3037struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3050: Function_InvokerUtil::IsFuncInvocable<RET(ARGS_01,
3069#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 0
3070template <
class RET,
class FUNC>
3071struct Function_IsInvocableWithPrototype<RET(), FUNC>
3076#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 1
3077template <
class RET,
class FUNC,
class ARGS_01>
3078struct Function_IsInvocableWithPrototype<RET(ARGS_01), FUNC>
3083#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 2
3084template <
class RET,
class FUNC,
class ARGS_01,
3086struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3092#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 3
3093template <
class RET,
class FUNC,
class ARGS_01,
3096struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3103#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 4
3104template <
class RET,
class FUNC,
class ARGS_01,
3108struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3116#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 5
3117template <
class RET,
class FUNC,
class ARGS_01,
3122struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3131#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 6
3132template <
class RET,
class FUNC,
class ARGS_01,
3138struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3148#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 7
3149template <
class RET,
class FUNC,
class ARGS_01,
3156struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3167#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 8
3168template <
class RET,
class FUNC,
class ARGS_01,
3176struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3188#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 9
3189template <
class RET,
class FUNC,
class ARGS_01,
3198struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3211#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 10
3212template <
class RET,
class FUNC,
class ARGS_01,
3222struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3236#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 11
3237template <
class RET,
class FUNC,
class ARGS_01,
3248struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3263#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 12
3264template <
class RET,
class FUNC,
class ARGS_01,
3276struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3292#if BSLSTL_FUNCTION_VARIADIC_LIMIT_C >= 13
3293template <
class RET,
class FUNC,
class ARGS_01,
3306struct Function_IsInvocableWithPrototype<RET(ARGS_01,
3330#ifdef BSLSTL_FUNCTION_INVOKERUTIL_SUPPORT_IS_FUNC_INVOCABLE
3332template <
class RET,
class FUNC,
class... ARGS>
3333struct Function_IsInvocableWithPrototype<RET(ARGS...), FUNC>
3334: Function_InvokerUtil::IsFuncInvocable<RET(ARGS...), FUNC> {
3339template <
class RET,
class FUNC,
class... ARGS>
3340struct Function_IsInvocableWithPrototype<RET(ARGS...), FUNC>
3356template <
class PROTOTYPE>
3357template <
class FUNC>
3362 typedef BloombergLP::bslstl::Function_InvokerUtil InvokerUtil;
3363 typedef InvokerUtil::GenericInvoker GenericInvoker;
3364 typedef typename Decay<FUNC>::type DecayedFunc;
3366 const DecayedFunc& decayedFunc = func;
3367 GenericInvoker *
const invoker =
3368 InvokerUtil::invokerForFunc<PROTOTYPE>(decayedFunc);
3375template <
class PROTOTYPE>
3377 : Base(allocator_type())
3381template <
class PROTOTYPE>
3383 : Base(allocator_type())
3387template <
class PROTOTYPE>
3390 const allocator_type& allocator)
3396template <
class PROTOTYPE>
3399 const allocator_type& allocator,
3405template <
class PROTOTYPE>
3407 : Base(allocator_type())
3409 this->d_rep.copyInit(original.d_rep);
3412template <
class PROTOTYPE>
3414 const allocator_type& allocator,
3415 const function& original)
3418 this->d_rep.copyInit(original.d_rep);
3421template <
class PROTOTYPE>
3425 : Base(MovableRefUtil::access(original).get_allocator())
3427 this->d_rep.moveInit(&MovableRefUtil::access(original).d_rep);
3430template <
class PROTOTYPE>
3433 const allocator_type& allocator,
3434 BloombergLP::bslmf::MovableRef<function> original)
3437 this->d_rep.moveInit(&MovableRefUtil::access(original).d_rep);
3441template <
class PROTOTYPE>
3445 function temp(allocator_arg, this->get_allocator(), rhs);
3446 this->d_rep.makeEmpty();
3447 this->d_rep.moveInit(&temp.d_rep);
3451template <
class PROTOTYPE>
3454 BloombergLP::bslmf::MovableRef<function> rhs)
3456 function temp(allocator_arg, this->get_allocator(),
3457 MovableRefUtil::move(rhs));
3458 this->d_rep.makeEmpty();
3459 this->d_rep.moveInit(&temp.d_rep);
3463template <
class PROTOTYPE>
3467 this->d_rep.makeEmpty();
3471template <
class PROTOTYPE>
3475 this->d_rep.
swap(other.d_rep);
3478template <
class PROTOTYPE>
3483 return this->d_rep.template target<TP>();
3488#ifdef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
3489template <
class PROTOTYPE>
3495 return 0 != this->d_rep.invoker();
3499template <
class PROTOTYPE>
3507template <
class PROTOTYPE>
3512 return this->d_rep.template target<TP>();
3515template <
class PROTOTYPE>
3516const std::type_info&
3519 return this->d_rep.target_type();
3522#ifndef BDE_OMIT_INTERNAL_DEPRECATED
3524template <
class PROTOTYPE>
3529 typedef BloombergLP::bdef_Function<PROTOTYPE *> Ret;
3530 return *
static_cast<Ret*
>(
this);
3533template <
class PROTOTYPE>
3536operator
const BloombergLP::bdef_Function<PROTOTYPE *>&()
const
3539 typedef const BloombergLP::bdef_Function<PROTOTYPE *> Ret;
3540 return *
static_cast<Ret*
>(
this);
3543template <
class PROTOTYPE>
3545BloombergLP::bslma::Allocator *
3548 return get_allocator().mechanism();
3551template <
class PROTOTYPE>
3560template <
class PROTOTYPE>
3568template <
class PROTOTYPE>
3576template <
class PROTOTYPE>
3584template <
class PROTOTYPE>
3592template <
class PROTOTYPE>
3609template <
class PROTO>
3610struct Function_InvokerUtilNullCheck<
bsl::function<PROTO> > {
3626#ifdef BSLS_ASSERTIMPUTIL_AVOID_STRING_CONSTANTS
3627#undef BSLS_ASSERTIMPUTIL_FILE
3628#define BSLS_ASSERTIMPUTIL_FILE BSLS_ASSERTIMPUTIL_DEFAULTFILE
3632# 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:737
Forward declaration.
Definition bslstl_function.h:946
Function_Rep::allocator_type allocator_type
Definition bslstl_function.h:1020
Definition bslmf_referencewrapper.h:182
Imp::Type Type
Definition bslmf_forwardingtype.h:441
Definition bslstl_function_rep.h:132
Definition bslstl_function.h:812
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2343
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2349
#define BSLS_DEPRECATE_FEATURE(UOR, FEATURE, MESSAGE)
Definition bsls_deprecatefeature.h:387
#define BSLS_KEYWORD_DELETED
Definition bsls_keyword.h:651
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:674
BloombergLP::bslma::Allocator * allocator() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_function.h:1863
function & operator=(const function &rhs)
Definition bslstl_function.h:1760
allocator_type get_allocator() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_function.h:1819
const std::type_info & target_type() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_function.h:1834
bool isInplace() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_function.h:1870
void swap(function &other) BSLS_KEYWORD_NOEXCEPT
Definition bslstl_function.h:1790
TP * target() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_function.h:1798
function() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_function.h:1693
bool operator!=(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
bool operator==(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
void swap(OptionValue &a, OptionValue &b)
Definition bdlat_valuetypefunctions.h:939
BloombergLP::bsls::Nullptr_Impl::Type nullptr_t
Definition bsls_nullptr.h:283
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:84
Definition bdldfp_decimal.h:5549
Definition bslmf_integralconstant.h:261
Definition bslmf_isnothrowmoveconstructible.h:361
static bool isNull(const FUNC &)
Return false.
Definition bslstl_function_invokerutil.h:831
static BSLA_NORETURN void throwBadFunctionCall()