Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::experimental::ranges::invoke

      From cppreference.com
      <cpp‎ |experimental‎ |ranges
       
       
       
       
      General utilities library
      Utility components
      Function objects
      invoke
      Metaprogramming and type traits
      Tagged pairs and tuples
                                
      tag specifiers
                                            
                                
       
      template<class F,class...Args>
      std::result_of_t<F&&(Args&&...)> invoke( F&& f, Args&&...args);
      (ranges TS)

      Invoke theCallable objectf with the parametersargs, and return the result, as if byreturn INVOKE(std::forward<F>(f),std::forward<Args>(args)...);, whereINVOKE(f, t1, t2, ..., tN) is defined as follows:

      • Ifstd::is_base_of<T,std::decay_t<decltype(t1)>>::value istrue, 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).
      • Ifstd::is_base_of<T,std::decay_t<decltype(t1)>>::value istrue, thenINVOKE(f, t1) is equivalent tot1.*f,
      • otherwise, thenINVOKE(f, t1) is equivalent to(*t1).*f.
      • otherwise,INVOKE(f, t1, t2, ..., tN) is equivalent tof(t1, t2, ..., tN) (that is,f is aFunctionObject).

      [edit]Parameters

      f -Callable object to be invoked
      args - arguments to pass tof

      [edit]See also

      (C++17)(C++23)
      invokes anyCallable object with given argumentsand possibility to specify return type(since C++23)
      (function template)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/experimental/ranges/functional/invoke&oldid=155351"

      [8]ページ先頭

      ©2009-2026 Movatter.jp