deduction guides for std::packaged_task
Min standard notice:
Header: <future>
- This deduction guide is provided for std::packaged_task to allow deduction from functions.
# Declarations
template< class R, class... Args >
packaged_task( R(*)(Args...) ) -> packaged_task<R(Args...)>;
(since C++17)
template< class F >
packaged_task( F ) -> packaged_task</*see below*/>;
(since C++17)
template< class F >
packaged_task( F ) -> packaged_task</*see below*/>;
(since C++23)
template< class F >
packaged_task( F ) -> packaged_task</*see below*/>;
(since C++23)
# Notes
These deduction guides do not allow deduction from a function with ellipsis parameter, and the … in the types is always treated as a pack expansion.
# Example
#include <future>
int func(double) { return 0; }
int main()
{
std::packaged_task f{func}; // deduces packaged_task<int(double)>
int i = 5;
std::packaged_task g = [&](double) { return i; }; // => packaged_task<int(double)>
}