In std::exchange, why is the second template parameter defaulted?
The std::exchange was proposed in N3511 without default template argument, and later N3608 with a default template argument. Note that in N3608 the following reasoning was provided: Giving the second template argument a default value fixes the following two cases: DefaultConstructible x = …; if (exchange(x, {})) { … } int (*fp)(int); int f(int); double … Read more