作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
struct bar { int x; };
struct qux
{
static const int foo[3] = { 1, 2, 3 }; // Error
static const bar baz = { 0 }; // Error
};
Visual Studio 2008;标准;
syntax error : '{'
最佳答案
只有整数static 非聚合成员可以在类中初始化。所有其他静态 成员(聚合或其他)必须在类外初始化。
//tag.h
struct tag
{
static const int foo[3]; //aggregate
static const bar baz; //aggregate
static const std::string s; //non-aggregate (non-integral type)
static const int x = 10; //ok : non-aggregate (integral type)
};
//tag.cpp
const int tag::foo[3] = { 1, 2, 3 }; //ok
const bar tag::baz = { 0 }; //ok
const std::string s = "example"; //ok
const int tag::x; //definition - if you want to take its address
关于c++ - 不支持成员聚合初始值设定项列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7194067/
我想成为 Spark 纱客户(link)。是否需要安装hadoop?还是只安装 yarn 可以吗? (by this link) 最佳答案 No Spark不需要Hadoop即可运行。 Apache
我是一名优秀的程序员,十分优秀!