Invoke c# là gì

  -  
This commit does not belong to any branch on this repository, and may belong khổng lồ a fork outside of the repository.

Bạn đang xem: Invoke c# là gì


Eggs.Invoke Introduction Reference Definitions Function template eggs::invoke Function template eggs::invoke_r Transformation Trait eggs::invoke_result Unary Type Traits eggs::is_invocable Unary Type Traits eggs::is_invocable_r Unary Type Traits eggs::is_nothrow_invocable Unary Type Traits eggs::is_nothrow_invocable_r Function-like macro EGGS_INVOKE Function-lượt thích macro EGGS_INVOKE_R CI Status
Eggs.Invoke

Introduction

Reference

DefinitionsDefine INVOKE(f, t1, t2, ..., tN) as follows:

(t1.*f)(t2, ..., tN) when f is a pointer khổng lồ a member function of aclass T and std::is_base_of_v>is true;

(t1.get().*f)(t2, ..., tN) when f is a pointer lớn a thành viên function of aclass T and std::remove_cvref_t is a specialization ofstd::reference_wrapper;

((*t1).*f)(t2, ..., tN) when f is a pointer to lớn a thành viên function of aclass T and t1 does not satisfy the previous two items;

t1.*f when N == 1 and f is a pointer to lớn data member of a class T andstd::is_base_of_v> is true;

t1.get().*f when N == 1 and f is a pointer to lớn data member of a classT and std::remove_cvref_t is a specialization ofstd::reference_wrapper;

(*t1).*f when N == 1 và f is a pointer khổng lồ data member of a class T& t1 does not satisfy the previous two items;

f(t1, t2, ..., tN) in all other cases.

Define INVOKE(f, t1, t2, ..., tN) as static_cast(INVOKE(f, t1, t2, ..., tN)) if R is cv void, otherwise INVOKE(f, t1, t2, ..., tN)implicitly converted to R.

Function template eggs::invoke
constexpr eggs::invoke_result_t invoke(F&và f, Args&và... args) noexcept(eggs::is_nothrow_invocable_v);">template class F, class... Args>constextruyền thông quảng cáo eggs::invoke_result_t invoke(F&và f, Args&&... args) noexcept(eggs::is_nothrow_invocable_v);
Returns: INVOKE(std::forward(f), std::forward(args)...).

Remarks: This function shall not participate in overload resolution unlesseggs::is_invocable_v is true.

Function template eggs::invoke_r
// (extension)constexpr R eggs::invoke_r(F&và f, Args&&... args) noexcept(eggs::is_nothrow_invocable_r_v);">template class R, class F, class... Args> // (extension)constextruyền thông quảng cáo R eggs::invoke_r(F&& f, Args&&... args) noexcept(eggs::is_nothrow_invocable_r_v);
Returns: INVOKE(std::forward(f), std::forward(args)...).

Remarks: This function shall not participate in overload resolution unlesseggs::is_invocable_r_v is true.

Transformation Trait eggs::invoke_result
struct invoke_result;">template class Fn, class... ArgTypes> struct invoke_result;
Comments: If the expression INVOKE(std::declval(), std::declval()...) is well-formed when treated as an unevaluatedoperand, the member typedef type names the type decltype(INVOKE(std::declval(), std::declval()...)); otherwise, there shall be no thành viên type.Access checking is performed as if in a context unrelated lớn Fn andArgTypes. Only the validity of the immediate context of the expression isconsidered.

Preconditions: Fn and all types in the template parameter pachồng ArgTypesare complete types, cv void, or arrays of unknown bound.

Xem thêm: Aliquots Là Gì - Aliquot Là Gì, Nghĩa Của Từ Aliquot


using invoke_result_t = typename invoke_result::type;">

template class Fn, class... ArgTypes>using invoke_result_t = typename invoke_result::type;
Unary Type Traits eggs::is_invocable
struct is_invocable;">template class Fn, class... ArgTypes> struct is_invocable;
Condition: The expression INVOKE(std::declval(), std::declval()...) is well-formed when treated as an unevaluatedopervà.

Comments: Fn và all types in the template parameter pachồng ArgTypesshall be complete types, cv void, or arrays of unknown bound.


// (C++14)inline constextruyền thông quảng cáo bool is_invocable_v = eggs::is_invocable::value;">

template class Fn, class... ArgTypes> // (C++14)inline constexquảng bá bool is_invocable_v = eggs::is_invocable::value;
Unary Type Traits eggs::is_invocable_r
struct is_invocable_r;">template class R, class Fn, class... ArgTypes> struct is_invocable_r;
Condition: The expression INVOKE(std::declval(), std::declval()...) is well-formed when treated as an unevaluatedoper&.

Comments: Fn, R, & all types in the template parameter packArgTypes shall be complete types, cv void, or arrays of unknown bound.


// (C++14)inline constexquảng bá bool is_invocable_r_v = eggs::is_invocable_r::value;">

template class R, class Fn, class... ArgTypes> // (C++14)inline constexquảng bá bool is_invocable_r_v = eggs::is_invocable_r::value;
Unary Type Traits eggs::is_nothrow_invocable
struct is_nothrow_invocable;">template class Fn, class... ArgTypes> struct is_nothrow_invocable;
Condition: eggs::is_invocable_v is true and theexpression INVOKE(std::declval(), std::declval()...) isknown not lớn throw any exceptions.

Comments: Fn & all types in the template parameter paông chồng ArgTypesshall be complete types, cv void, or arrays of unknown bound.


// (C++14)inline constextruyền thông quảng cáo bool is_nothrow_invocable_v = eggs::is_nothrow_invocable::value;">

template class Fn, class... ArgTypes> // (C++14)inline constexquảng cáo bool is_nothrow_invocable_v = eggs::is_nothrow_invocable::value;
Unary Type Traits eggs::is_nothrow_invocable_r
struct is_nothrow_invocable_r;">template class R, class Fn, class... ArgTypes> struct is_nothrow_invocable_r;
Condition: eggs::is_invocable_r_v is true and theexpression INVOKE(std::declval(), std::declval()...) isknown not to throw any exceptions.

Comments: Fn, R, and all types in the template parameter packArgTypes shall be complete types, cv void, or arrays of unknown bound.

Xem thêm: Top 10+ Ngân Hàng Nào Tốt Nhất Việt Nam, Top 10 Ngân Hàng Lớn Nhất Việt Nam Hiện Nay 2021


// (C++14)inline constexquảng bá bool is_nothrow_invocable_r_v = eggs::is_nothrow_invocable_r::value;">

template class R, class Fn, class... ArgTypes> // (C++14)inline constexquảng cáo bool is_nothrow_invocable_r_v = eggs::is_nothrow_invocable_r::value;
Function-like macro EGGS_INVOKE
#define EGGS_INVOKE(F, ...) // (extension)
Returns: INVOKE(F __VA_OPT__(,) __VA_ARGS__).Function-lượt thích macro EGGS_INVOKE_R
#define EGGS_INVOKE_R(R, F, ...) // (extension)
Returns: INVOKE(F __VA_OPT__(,) __VA_ARGS__).

CI Status

Distributed under the Boost Software License, Version 1.0. (See accompanyingfile LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)