A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/iterator/../language/../utility/functional/function/target.html below:

std::function<R(Args...)>::target - cppreference.com

template< class T >
T* target() noexcept;

(1) (since C++11)

template< class T >
const T* target() const noexcept;

(2) (since C++11)

Returns a pointer to the stored callable function target.

[edit] Parameters

(none)

[edit] Return value

A pointer to the stored function if target_type() == typeid(T), otherwise a null pointer.

[edit] Example

Output:

test function: it is plus
test function: it is minus
test function: it is the function f
test function: it is the function g
[edit] 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 2591 C++11 the behavior is undefined if T is not Callable behavior is defined (always returns nullptr) [edit] See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4