constexpr关键字让用户显式的声明函数或对象构造函数在编译期会成为常数。
可以用于数组的定义:
constexpr int func(){
}
int main()
{
int a[func()];
return 0;
}
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/223672.html原文链接:https://javaforall.net
关于constexprconstexpr 关键字让用户显式的声明函数或对象构造函数在编译期会成为常数 可以用于数组的定义 constexprint nbsp nbsp return10 intmain nbsp nbsp nbsp nbsp inta func nbsp nbsp nbsp nbsp return0
constexpr关键字让用户显式的声明函数或对象构造函数在编译期会成为常数。
可以用于数组的定义:
constexpr int func(){
}
int main()
{
int a[func()];
return 0;
}
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/223672.html原文链接:https://javaforall.net