http://open-std.org/JTC1/SC22/WG21/docs/papers/2019/p1045r1.html

On Apr 7, 2021, at 1:23 PM, Phil Bouchard via Std-Proposals <std-proposals@lists.isocpp.org> wrote:

This message was sent from a non-IU address. Please exercise caution when clicking links or opening attachments from external sources.

Greetings,

In some cases it would be useful to overload functions based on knowing if a variable is a compile-time constant or not. For example:

void foo(int size)
{
    cout << 1 << endl;
}

template <int Size>
    void foo(int Size)
    {
        cout << 2 << endl;
    }

int main(int argc, char * argv[])
{
    foo(argc); // outputs 1
    foo(sizeof(int)); // outputs 2
}


Regards,

--

Phil Bouchard

Founder
C.: (819) 328-4743

Fornux Logo
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals