Unfortunately, "nondeduced" does not work here, because the pack
expansion is outside of it. Compilers appear to expand the pack before
deducing the elements:
template<typename ...T, class Z>
void f(void(nodeduced_t<T>..., Z)) { }
void g(int, char) { }
int main() {
f<int>(g);
}
This will not compile, apparently compilers create "void(int,
nondeduced_t<T>, Z)" and try to compare "nondeduced_t<T>" against
"char". My "protected" prevents this "growing" of the parameter pack.
The case for "tuple<int>" refers to template argument deduction for
class templates, i.e "std::tuple t(10)". The problem with partially
specifying template arguments is that the deduction guide provides
template<Outer ...T = <int, ...>>
tuple(<int, Outer> &&... t);
And will extend "Outer" with whatever constructor arguments you pass
in. The "protected" would forbid this analog here. Perhaps here we can
put a workaround in terms of a trailing parameter pack, and put a
condition that causes an SFINAE check failure.. This would cause
deduction guides to not extend "Outer", but put the further args into
"SfinareCheck", later SFINAE-failing and not doing that deduction
(would that work??). But that's far from elegant, so I guess this is
not an option
template<typename ...SfinaeCheck, typename
std::enable_if<sizeof...(SfinaeCheck)==0,int>::type=0>
tuple(Outer &&... outers, SfinaeCheck &&...);
Apart from that, the workaround wouldn't work for the function pointer
case above anyway.
> --
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
std-proposal...@isocpp.org.
> To post to this group, send email to
std-pr...@isocpp.org.
> To view this discussion on the web visit
>
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/6dda12e3-acbd-40ab-ae5d-afe538fbf308%40isocpp.org.