代码拉取完成,页面将自动刷新
//
// 2.21.inline.variable.cpp
// chapter 2 language usability
// modern cpp tutorial
//
// created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
//
#include <iostream>
struct Widget {
// C++17: define and initialize a static data member inside the class
static inline int count = 0;
Widget() { ++count; }
};
// C++17: an inline variable can be safely defined in a header and
// included by multiple translation units without violating the ODR
inline int global_value = 42;
int main() {
Widget a, b, c;
std::cout << "Widget::count = " << Widget::count << std::endl; // 3
std::cout << "global_value = " << global_value << std::endl; // 42
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。