std::experi...nges::invoke(3)
π NAME π
std::experimental::ranges::invoke β std::experimental::ranges::invoke
This one comes from the C++ Standard Libary manual (yes, βLibaryβ is literally how itβs spelled on the page, bestie π). Itβs giving βinvoke things correctlyβ energy, and honestly? Iconic.
β¨ Synopsis β¨
Defined in header <experimental/ranges/functional>
template< class F, class... Args >
(ranges TS)
std::result_of_t<F&&(Args&&...)> invoke( F&& f, Args&&... args );
Okay so the vibe is: invoke the Callable object f with the parameters args, and return the result, as if by return INVOKE(std::forward<F>(f), std::forward<Args>(args)...);, where INVOKE(f, t1, t2, ..., tN) is defined as follows:
- if
fis a pointer to member function of classT:- If
std::is_base_of<T, std::decay_t<decltype(t1)>>::valueis true, thenINVOKE(f, t1, t2, ..., tN)is equivalent to(t1.*f)(t2, ..., tN), - otherwise,
INVOKE(f, t1, t2, ..., tN)is equivalent to((*t1).*f)(t2, ..., tN).
- If
- otherwise, if
N == 1andfis a pointer to data member of classT:- If
std::is_base_of<T, std::decay_t<decltype(t1)>>::valueis true, thenINVOKE(f, t1)is equivalent tot1.*f, - otherwise, then
INVOKE(f, t1)is equivalent to(*t1).*f.
- If
- otherwise,
INVOKE(f, t1, t2, ..., tN)is equivalent tof(t1, t2, ..., tN)(that is,fis a FunctionObject).
π Parameters π
fβ Callable object to be invokedargsβ arguments to pass tof
π See also π
The See also block lists:
invokeβ invokes any Callable object with given argumentsinvoke_rand possibility to specify return type- the markers it carries:
(C++17),(since C++23),(C++23),(function template)
Source/version/date sign-off: http://cppreference.com Β· 2024.06.10 Β· page std::experi...nges::invoke(3). Byeee, go invoke something cute π«Άπ
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms