相关疑难解决方法(0)

静态constexpr变量有意义吗?

如果我有一个函数(比方说,一个大阵列)内的变量,它是有意义的声明它既staticconstexprconstexpr保证数组是在编译时创建的,那么它会static没用吗?

void f() {
    static constexpr int x [] = {
        // a few thousand elements
    };
    // do something with the array
}
Run Code Online (Sandbox Code Playgroud)

static在生成的代码或语义方面,实际上是在做什么吗?

c++ static constexpr c++11

172
推荐指数
3
解决办法
7万
查看次数

标签 统计

c++ ×1

c++11 ×1

constexpr ×1

static ×1