gpt4 book ai didi

c++ - 模板参数中的 "T"和 "const T"有区别吗?

转载 作者:行者123 更新时间:2023-12-05 06:53:30 24 4
gpt4 key购买 nike

下面两种语法有区别吗:

template<int N> struct A;         // (1)

template<const int N> struct A;   // (2)

关于何时使用每种语法的任何一般准则?

最佳答案

没有。

§14.1 [temp.param] p5

[...] The top-level cv-qualifiers on the template-parameter are ignored when determining its type.

关于c++ - 模板参数中的 "T"和 "const T"有区别吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65775669/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com