Date: Wed, 7 Apr 2021 20:33:01 +0000
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_at_[hidden]> 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,
On Apr 7, 2021, at 1:23 PM, Phil Bouchard via Std-Proposals <std-proposals_at_[hidden]> 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<tel:(819)%20328-4743> [Fornux Logo]<http://www.fornux.com/> -- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2021-04-07 15:33:17