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
std::function::target_type(3) C++ Standard Libary std::function::target_type(3)

std::function::target_type - std::function::target_type


const std::type_info& target_type() const noexcept; (since C++11)


Returns the type of the stored function.


(none)


typeid(T) if the stored function has type T, otherwise typeid(void)

// Run this code


#include <functional>
#include <iostream>


int f(int a) { return -a; }
void g(double) {}
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';


// since C++17 deduction guides (CTAD) can avail
std::cout << std::function{g}.target_type().name() << '\n';
}


PFiiE
Z4mainEUliE_
PFvdE


target obtains a pointer to the stored target
(public member function)

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.