Date: Tue, 16 Jul 2024 16:34:25 +0300
I made an update and I think it should be fine now. I added the "except that if P is an array type, U(&)[N] is used in place of P as a function template parameter type where N is a function non-type template parameter of type
std::size_t"
part. I think it should be fine now cause we can deduce U fromtemplate <class U, std::size_t N>
void g(U(&&)[N]) { }
int main() {
g({1, 2, 3, 4, 5}); // OK
}
According to the [temp.deduct.call]
16.07.2024, 15:14, "Данил Сидорук" <danilsidoruknv_at_[hidden]>:
I got that we can't just remove `T shall not be an array type` and make few changes in the next paragraph. Cause we can't deduce array type using the rules of template argument deduction from a function call with initializer list:
#include <cstdio>template <class U>void f(U(&u)[]) {}int main() {f({1, 2, 3, 4, 5}); // Doesn't work}--Danil Sidoruk
--
Danil Sidoruk
Received on 2024-07-16 13:34:29