Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::function_ref

      From cppreference.com
      <cpp‎ |utility‎ |functional
       
       
      Utilities library
       
      Function objects
      Function invocation
      (C++17)(C++23)
      Identity function object
      (C++20)
      Old binders and adaptors
      (until C++17*)
      (until C++17*)
      (until C++17*)
      (until C++17*)  
      (until C++17*)
      (until C++17*)(until C++17*)(until C++17*)(until C++17*)
      (until C++20*)
      (until C++20*)
      (until C++17*)(until C++17*)
      (until C++17*)(until C++17*)

      (until C++17*)
      (until C++17*)(until C++17*)(until C++17*)(until C++17*)
      (until C++20*)
      (until C++20*)
       
       
      Defined in header<functional>
      template<class...>
      class function_ref;// not defined
      (1)(since C++26)
      template<class R,class...Args>

      class function_ref<R(Args...)>;
      template<class R,class...Args>
      class function_ref<R(Args...)noexcept>;
      template<class R,class...Args>
      class function_ref<R(Args...)const>;
      template<class R,class...Args>

      class function_ref<R(Args...)constnoexcept>;
      (2)(since C++26)

      Class templatestd::function_ref is a non-owning function wrapper.std::function_ref objects can store and invoke reference toCallabletarget - functions,lambda expressions,bind expressions, or other function objects, but not pointers to member functions and pointers to member objects.std::nontype can be used to constructstd::function_ref by passing function pointers, pointers to member functions, and pointers to member objects.

      std::function_refs supports every possible combination ofcv-qualifiers (excludingvolatile), andnoexcept-specifiers provided in its template parameter.

      Every specialization ofstd::function_ref is aTriviallyCopyable type that satisfiescopyable.

      Contents

      [edit]Member types

      Member Definition
      BoundEntityType(private) unspecifiedTriviallyCopyable type that satisfiescopyable and is capable of storing a pointer to object value or pointer to function value
      (exposition-only member type*)
      FunctionPointerType(private)R(*)(BoundEntityType , Args&&...)noexcept(noex )

      wherenoex istrue ifnoexcept is present in function signature as part of the template parameter ofstd::function_ref,false otherwise
      (exposition-only member type*)

      [edit]Data members

      Member Definition
      BoundEntityTypebound-entity a bound entity object
      (exposition-only member object*)
      FunctionPointerTypethunk-ptr a stored pointer to function
      (exposition-only member object*)

      [edit]Member functions

      constructs a newfunction_ref object
      (public member function)[edit]
      assigns afunction_ref
      (public member function)[edit]
      invokes the stored thunk of afunction_ref
      (public member function)[edit]

      [edit]Deduction guides

      [edit]Notes

      Feature-test macroValueStdFeature
      __cpp_lib_function_ref202306L(C++26)std::function_ref

      [edit]Example

      This section is incomplete
      Reason: example

      [edit]See also

      (C++11)
      copyable wrapper of any copy constructible callable object
      (class template)[edit]
      copyable wrapper of any copy constructible callable object that supports qualifiers in a given call signature
      (class template)[edit]
      move-only wrapper of any callable object that supports qualifiers in a given call signature
      (class template)[edit]
      value construction tag
      (tag)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/utility/functional/function_ref&oldid=178861"

      [8]ページ先頭

      ©2009-2025 Movatter.jp