C++ Logo

std-proposals

Advanced search

[std-proposals] Explicit template parameters

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Sun, 3 Jul 2022 13:02:06 +0100
Earlier this year on 25 March, I shared my idea to this mailing list of
using the 'explicit' keyword on template parameters as follows:

    template<explicit class T>
    void Func(T &arg)
    {
        /* Do Something */
    }

The idea was that you would have to write:

    int main(void)
    {
        int i;

        Func<int>(i);
    }

because the 'explicit' keyword would prevent automatic deduction of the
type T.

You can see my original post archived here:

    https://lists.isocpp.org/std-proposals/2022/03/3721.php

That same week, another contributor made another suggestion that looked
similar to what I was suggesting, but which was very different in
functionality. My own suggestion I think got lost in the paperwork back and
forth, and so I would like to bring it to people's attention again now, as
I've shared the idea elsewhere and people seeming to be overwhelming in
support of it.

Received on 2022-07-03 11:57:50