This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-12-19


947. Deducing type template arguments from default function arguments

Section: 13.10.4  [temp.over]     Status: NAD     Submitter: Dave Abrahams     Date: 27 July, 2009

It would be useful to be able to deduce the type of a function template argument from a corresponding default function argument expression, for example:

    template <class T> int f(T = 0);
    int x = f();

A more realistic use case would be

    template <class T, class U>
    int f(T x, U y = pair<T, T>());

Ideally one would also like

    template <class T, class U>
    int f(T x, U y = g(x));

These capabilities are part of the Boost parameter library, so there should not be issues of implementability.

Rationale (February, 2014):

EWG determined that no action should be taken on this issue.