PR libstdc++/69724 avoid temporary in std::thread construction
authorJonathan Wakely <jwakely@redhat.com>
Tue, 14 May 2019 12:01:15 +0000 (13:01 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 14 May 2019 12:01:15 +0000 (13:01 +0100)
commit8db7a05fd73be5df9195a3697248084d4a5b0ee6
tree77beac2f9222970cb655b89af0af57d715b2a46b
parentdb33efde17932fb29fd08f19eaeef0e527adb065
PR libstdc++/69724 avoid temporary in std::thread construction

The std::thread constructor creates (and then moves) an unnecessary
temporary copy of each argument. Optimize it to only make the one copy
that is required.

PR libstdc++/69724
* include/std/thread (thread::_State_impl, thread::_S_make_state):
Replace single _Callable parameter with variadic _Args pack, to
forward them directly to the tuple of decayed copies.
* testsuite/30_threads/thread/cons/69724.cc: New test.

From-SVN: r271166
libstdc++-v3/ChangeLog
libstdc++-v3/include/std/thread
libstdc++-v3/testsuite/30_threads/thread/cons/69724.cc [new file with mode: 0644]