Topic: Deducing class template arguments from function argument


Author: "'Johannes Schaub' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Sun, 11 Sep 2016 00:27:38 +0200
Raw View
Hello all, now that we have

   C c = a; // means C<DeducedT>

Could we perhaps make this work?

    template<typename T>
    void f(C<T> c);

    f(a); // means f<DeducedT>(a);

This seems useful. For example, if std::function<F> has constructor
overloads for "F*", this would allow deduction in

    template<typename A>
    void f(std::function<void(A)> f) { }

    void g(int) { }

    int main() { f(g); }

Thanks!

--
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-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CANu6V4U1BbXwM_vSmwNJPnoBsM%3DTBXCkv3UQEAbKRTMpBRXhsw%40mail.gmail.com.

.