Skip to content

Commit 70ac451

Browse files
author
mikeblome
committed
fixed up f1 topic
1 parent f6a45e2 commit 70ac451

File tree

2 files changed

+56
-10
lines changed

2 files changed

+56
-10
lines changed

docs/cpp/import-export-module.md

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,58 @@
11
---
2-
title: "import and export module statement"
3-
ms.date: "07/06/2019"
4-
helpviewer_keywords: ["import module [C++]", "modules [C++], import"]
2+
title: "module, import, export"
3+
ms.date: "07/15/2019"
4+
f1_keywords: ["module_cpp", "import_cpp", "export_cpp"]
5+
helpviewer_keywords: ["modules [C++]", "modules [C++], import", "modules [C++], export"]
56
ms.description: Use the import statement to access types and functions defined in the specified module.
6-
---
7+
---
8+
9+
## import, export, module
10+
11+
### module
12+
Use the **module** statement at the beginning of a module implemetation file to specify that the file contents belong to the named module.
13+
14+
```cpp
15+
module ModuleA;
16+
```
17+
18+
### export
19+
Use the **export module** statement for the module's primary interface file, which must have extension **.ixx**:
20+
21+
```cpp
22+
export module ModuleA;
23+
```
24+
25+
In an interface file, use the **export** modifier on names that are intended to be part of the public interface:
26+
27+
```cpp
28+
export module ModuleA;
29+
30+
namespace Bar
31+
{
32+
export int f();
33+
export std::string s();
34+
}
35+
```
36+
37+
When the **export** modifier is applied to a namespace name, all names in the namespace are exported. The **export** keyword may not appear in a module implementation file.
38+
39+
### import
40+
41+
Use the **import** statement to make a module's names visible in your program. The import statement must appear after the module statement and after any #include directives, but before any declarations in the file.
42+
43+
```cpp
44+
module ModuleA;
45+
46+
#include "custom-lib.h"
47+
import std.core;
48+
import std.regex;
49+
import ModuleB;
50+
51+
// begin declarations here:
52+
template <class T>
53+
class Baz
54+
{...};
55+
```
56+
57+
## See Also
58+
[Overview of modules in C++](modules-cpp.md)

docs/cpp/import-module.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)