GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
deductionguidesforstd::function(3) C++ Standard Libary deductionguidesforstd::function(3)

deductionguidesforstd::function - deductionguidesforstd::function


Defined in header <functional>
template< class R, class... ArgTypes > (1) (since C++17)
function( R(*)(ArgTypes...) ) -> function<R(ArgTypes...)>;
template< class F > (2) (since C++17)
function( F ) -> function</*see below*/>;


1) This deduction guide is provided for std::function to allow deduction from
functions.
2) This overload participates in overload resolution only if &F::operator() is
well-formed when treated as an unevaluated operand and decltype(&F::operator()) is
of the form R(G::*)(A...) (optionally cv-qualified, optionally noexcept, optionally
lvalue reference qualified) for some class type G. The deduced type is
std::function<R(A...)>.


The type deduced by these deduction guides may change in a later standard revision
(in particular, this might happen if noexcept support is added to std::function in a
later standard).

// Run this code


#include <functional>
int func(double) { return 0; }
int main() {
std::function f{func}; // guide #1 deduces function<int(double)>
int i = 5;
std::function g = [&](double) { return i; }; // guide #2 deduces function<int(double)>
}


Defect reports


The following behavior-changing defect reports were applied retroactively to
previously published C++ standards.


DR Applied to Behavior as published Correct behavior
LWG 3238 C++17 behavior of (2) was unclear clarified

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.