![]() |
MySQL 9.6.0
Source Code Documentation
|
false if Args is exactly one type, say A, and std::decay_t<A> equals Type.
More...
#include <not_decayed.h>
false if Args is exactly one type, say A, and std::decay_t<A> equals Type.
The use case is to constrain constructors taking (variadic) forwarding reference arguments, so they cannot be invoked as copy constructor. Here is a typical example:
Here, we expect that w2's copy constructor is invoked. If we would omit the Not_decayed constraint, the forwarding constructor would have been "better" according to C++'s overload resolution rules. The Not_decayed constraint excludes the forwarding constructor from the candidates and thus makes the copy constructor be the only viable overload.
See also https://akrzemi1.wordpress.com/2013/10/10/too-perfect-forwarding/