阅读背景:

关于静态模板化constexpr的Clang警告(未定义内联函数)

来源:互联网 

I have the following c++ code:

我有以下c++代码:

#include <array>
#include <iostream>

typedef unsigned char uchar;

class A {
public:
    template <size_t N, uchar value>
    static inline constexpr std::array<uchar, N> filledArray() {
        std::array<uchar,N> ret{};
        ret.fill(value);
        return ret;
    }

    std::array<uchar, 5> upper = A::filledArray<5, 'A'>();
};

int main() {
    A blah;
    for (int i = 0; i < 5; ++i)
        std::cout << blah.upper[i] << std::endl;
    return 0;
}
#



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: