8#ifndef INCLUDED_BDLF_OVERLOADED
9#define INCLUDED_BDLF_OVERLOADED
96#include <bslscm_version.h>
106#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
115template <
class RET,
class ...ARGS>
116struct Overloaded_FunctionPointer
119 using FpType = RET (*)(ARGS...);
127 Overloaded_FunctionPointer(FpType f);
132 RET operator()(ARGS&&... args)
const;
142template <
class RET,
class ...ARGS>
143struct Overloaded_NoexceptFunctionPointer
147 using FpType = RET (*)(ARGS...)
noexcept;
155 Overloaded_NoexceptFunctionPointer(FpType f);
160 RET operator()(ARGS&&... args)
const noexcept;
171template <
class OBJ,
class RET,
class ...ARGS>
172struct Overloaded_MemberFunctionPointer
175 using FpType = RET (OBJ::*)(ARGS...);
183 Overloaded_MemberFunctionPointer(FpType f);
189 RET operator()(OBJ * obj, ARGS&&... args)
const;
200template <
class OBJ,
class RET,
class ...ARGS>
201struct Overloaded_ConstMemberFunctionPointer
204 using FpType = RET (OBJ::*)(ARGS...) const;
212 Overloaded_ConstMemberFunctionPointer(FpType f);
218 RET operator()(
const OBJ * obj, ARGS&&... args)
const;
229template <
class OBJ,
class RET,
class ...ARGS>
230struct Overloaded_NoexceptMemberFunctionPointer
233 using FpType = RET (OBJ::*)(ARGS...) noexcept;
241 Overloaded_NoexceptMemberFunctionPointer(FpType f);
247 RET operator()(OBJ * obj, ARGS&&... args)
const noexcept;
258template <
class OBJ,
class RET,
class ...ARGS>
259struct Overloaded_ConstNoexceptMemberFunctionPointer
262 using FpType = RET (OBJ::*)(ARGS...) const noexcept;
270 Overloaded_ConstNoexceptMemberFunctionPointer(FpType f);
276 RET operator()(
const OBJ * obj, ARGS&&... args)
const noexcept;
293struct Overloaded_Wrapper {
299template <
class RET,
class ...ARGS>
300struct Overloaded_Wrapper<RET (*)(ARGS...)> {
302 using Type = Overloaded_FunctionPointer<RET, ARGS...>;
305template <
class RET,
class ...ARGS>
306struct Overloaded_Wrapper<RET (*)(ARGS...) noexcept> {
308 using Type = Overloaded_NoexceptFunctionPointer<RET, ARGS...>;
312template <
class OBJ,
class RET,
class ...ARGS>
313struct Overloaded_Wrapper<RET (OBJ::*)(ARGS...)> {
315 using Type = Overloaded_MemberFunctionPointer<OBJ, RET, ARGS...>;
318template <
class OBJ,
class RET,
class ...ARGS>
319struct Overloaded_Wrapper<RET (OBJ::*)(ARGS...) const> {
321 using Type = Overloaded_ConstMemberFunctionPointer<OBJ, RET, ARGS...>;
324template <
class OBJ,
class RET,
class ...ARGS>
325struct Overloaded_Wrapper<RET (OBJ::*)(ARGS...) noexcept> {
327 using Type = Overloaded_NoexceptMemberFunctionPointer<OBJ, RET, ARGS...>;
330template <
class OBJ,
class RET,
class ...ARGS>
331struct Overloaded_Wrapper<RET (OBJ::*)(ARGS...) const noexcept> {
334 Overloaded_ConstNoexceptMemberFunctionPointer<OBJ, RET, ARGS...>;
345struct Overloaded : Overloaded_Wrapper<TS>::Type...
347 using Overloaded_Wrapper<TS>::Type::operator()...;
352Overloaded(TS...) -> Overloaded<TS...>;
363template <
class RET,
class ...ARGS>
364Overloaded_FunctionPointer<RET, ARGS...>::Overloaded_FunctionPointer(
365 typename Overloaded_FunctionPointer<RET, ARGS...>::FpType f)
370template <
class RET,
class ...ARGS>
372RET Overloaded_FunctionPointer<RET, ARGS...>::operator()(ARGS&&... args)
const
374 return d_fp(std::forward<ARGS>(args)...);
382template <
class RET,
class ...ARGS>
383Overloaded_NoexceptFunctionPointer<RET, ARGS...>
384 ::Overloaded_NoexceptFunctionPointer(
385 typename Overloaded_NoexceptFunctionPointer<RET, ARGS...>::FpType f)
390template <
class RET,
class ...ARGS>
392RET Overloaded_NoexceptFunctionPointer<RET, ARGS...>::operator()
393 (ARGS&&... args)
const noexcept
395 return d_fp(std::forward<ARGS>(args)...);
403template <
class OBJ,
class RET,
class ...ARGS>
404Overloaded_MemberFunctionPointer<OBJ, RET, ARGS...>
405 ::Overloaded_MemberFunctionPointer(
406 typename Overloaded_MemberFunctionPointer<OBJ, RET, ARGS...>::FpType f)
411template <
class OBJ,
class RET,
class ...ARGS>
413RET Overloaded_MemberFunctionPointer<OBJ, RET, ARGS...>::operator()
414 (OBJ * obj, ARGS&&... args)
const
416 return (obj->*d_fp)(std::forward<ARGS>(args)...);
424template <
class OBJ,
class RET,
class ...ARGS>
425Overloaded_ConstMemberFunctionPointer<OBJ, RET, ARGS...>
426 ::Overloaded_ConstMemberFunctionPointer(
typename
427 Overloaded_ConstMemberFunctionPointer<OBJ, RET, ARGS...>::FpType f)
432template <
class OBJ,
class RET,
class ...ARGS>
434RET Overloaded_ConstMemberFunctionPointer<OBJ, RET, ARGS...>::operator()
435 (
const OBJ * obj, ARGS&&... args)
const
437 return (obj->*d_fp)(std::forward<ARGS>(args)...);
445template <
class OBJ,
class RET,
class ...ARGS>
446Overloaded_NoexceptMemberFunctionPointer<OBJ, RET, ARGS...>
447 ::Overloaded_NoexceptMemberFunctionPointer(
typename
448 Overloaded_NoexceptMemberFunctionPointer<OBJ, RET, ARGS...>::FpType f)
453template <
class OBJ,
class RET,
class ...ARGS>
455RET Overloaded_NoexceptMemberFunctionPointer<OBJ, RET, ARGS...>
456 ::operator()(OBJ * obj, ARGS&&... args)
const noexcept
458 return (obj->*d_fp)(std::forward<ARGS>(args)...);
466template <
class OBJ,
class RET,
class ...ARGS>
467Overloaded_ConstNoexceptMemberFunctionPointer<OBJ, RET, ARGS...>
468 ::Overloaded_ConstNoexceptMemberFunctionPointer(
typename
469 Overloaded_ConstNoexceptMemberFunctionPointer<OBJ, RET, ARGS...>::FpType f)
474template <
class OBJ,
class RET,
class ...ARGS>
476RET Overloaded_ConstNoexceptMemberFunctionPointer<OBJ, RET, ARGS...>
477 ::operator()(
const OBJ * obj, ARGS&&... args)
const noexcept
479 return (obj->*d_fp)(std::forward<ARGS>(args)...);
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
Definition bdlf_bind.h:979