A RetroSearch Logo

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

Search Query:

Showing content from http://en.cppreference.com/w/cpp/language/../utility/functional/function/operator().html below:

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

R operator()( Args... args ) const;

(since C++11)

Invokes the stored callable function target with the parameters args.

Effectively does INVOKE<R>(f, std::forward<Args>(args)...), where f is the target object of *this.

[edit] Parameters args - parameters to pass to the stored callable function target [edit] Return value

None if R is void. Otherwise the return value of the invocation of the stored callable object.

[edit] Exceptions

Throws std::bad_function_call if *this does not store a callable function target, i.e. !*this == true.

[edit] Example

The following example shows how std::function can be passed to other functions by value. Also, it shows how std::function can store lambdas.

Possible output:

bad_function_call
1
2
42
Hi 42
[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