Add minimal example
This commit is contained in:
parent
1827006b02
commit
1402505a6d
7 changed files with 48 additions and 0 deletions
6
examples/minimal/src/generators/number.cppm
Normal file
6
examples/minimal/src/generators/number.cppm
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export module generators.number;
|
||||
|
||||
// Example function that returns a number
|
||||
export int get_number() {
|
||||
return 42;
|
||||
}
|
||||
6
examples/minimal/src/generators/text.cppm
Normal file
6
examples/minimal/src/generators/text.cppm
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export module generators.text;
|
||||
|
||||
// Example function that returns a string
|
||||
export const char* get_text() {
|
||||
return "meow!";
|
||||
}
|
||||
6
examples/minimal/src/main.cpp
Normal file
6
examples/minimal/src/main.cpp
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import printing;
|
||||
|
||||
// Example main function that calls a function from a module to print things
|
||||
int main() {
|
||||
print_things();
|
||||
}
|
||||
14
examples/minimal/src/printing.cppm
Normal file
14
examples/minimal/src/printing.cppm
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
module;
|
||||
|
||||
#include <iostream>
|
||||
|
||||
import generators.number;
|
||||
import generators.text;
|
||||
|
||||
export module printing;
|
||||
|
||||
// Example function that prints things from the generator functions
|
||||
export void print_things() {
|
||||
std::cout << get_text() << '\n';
|
||||
std::cout << get_number() << '\n';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue