Standard specifies:
template<class R, class... ArgTypes> void swap(packaged_task<R(ArgTypes...)>& x, packaged_task<R(ArgTypes...)>& y) noexcept;
Differential D99102
[libc++] Match declaration for non-member function std::swap(std::packaged_task) with what standard specify jasonliu on Mar 22 2021, 12:20 PM. Authored by
Details
Standard specifies: template<class R, class... ArgTypes> void swap(packaged_task<R(ArgTypes...)>& x, packaged_task<R(ArgTypes...)>& y) noexcept;
Diff Detail Event TimelineComment Actions Hard no. std::swap is not meant to be called with explicit template arguments (and especially not random arguments like <double, int, char>). Comment Actions Agreed with Arthur about the fact that it's not supposed to be called that way. However, the Standard does specify it as being swap(packaged_task<C(A...)>): http://eel.is/c++draft/futures.task#nonmembers-1. So I'm fine with the change as decreasing distance from the Standard, but I think we should *not* add a test. Comment Actions Got it. Make sense. I removed the test case in case we want to have the declaration be more like what standard have in the text. Comment Actions Sure; I'm still uncomfortable with making this change to enable the discouraged use-case (even without the test). But there's no real chance anyone would ever ask to change the code back to the old version. |