| (since C++11) |
Returns the type of the stored function.
Parameters
(none).
Return value
typeid(T)
if the stored function has type T
, otherwise typeid(void)
.
Exceptions
noexcept
specification: noexcept
Example
1 2 3 4 5 6 7 8 9 10 11 12 | #include <functional> #include <iostream> int f( int a) { return -a; } int main() { // fn1 and fn2 have the same type, but their targets do not std::function< int ( int )> fn1(f), fn2([]( int a) { return -a;}); std::cout << fn1.target_type().name() << '\n' << fn2.target_type().name() << '\n' ; } |
Possible output:
1 2 | int (*)( int ) main::$_0 |
See also
obtains a pointer to the stored target (public member function) |
Please login to continue.