命名空间
变体
操作

C++ 具有特殊含义的标识符: module (自 C++20 起)

来自 cppreference.cn
< cpp
 
 
C++ 语言
通用主题
流程控制
条件执行语句
if
迭代语句(循环)
for
范围for (C++11)
跳转语句
函数
函数声明
Lambda 函数表达式
inline 说明符
动态异常规范 (直到 C++17*)
noexcept 说明符 (C++11)
异常
命名空间
类型
说明符
const/volatile
decltype (C++11)
auto (C++11)
constexpr (C++11)
consteval (C++20)
constinit (C++20)
存储持续时间说明符
初始化
 
 

[[编辑]] 用法

[[编辑]] 示例

module;            // starts a global module fragment
 
#include <string>
 
export module foo; // ends a global module fragment
                   // declares the primary module interface unit for named module 'foo'
                   // starts a module unit purview
 
export std::string f();
 
module : private;  // ends the portion of the module interface unit that
                   // can affect the behavior of other translation units
                   // starts a private module fragment
 
std::string f()
{
    return "foo";
}

[[编辑]] 参见