@@ -4,10 +4,10 @@ Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
4
4
5
5
## C++14/17 features used in f18
6
6
7
- The C++ dialect used in this project is a subset of the
7
+ The C++ dialect used in this project constitutes a subset of the
8
8
standard C++ programming language and library features.
9
- We want it to be compatible with the LLVM C++ language
10
- subset in use at the time that we integrate with that
9
+ We want our dialect to be compatible with the LLVM C++ language
10
+ subset that will be in use at the time that we integrate with that
11
11
project.
12
12
We also want to maximize portability, future-proofing,
13
13
compile-time error checking, and use of best practices.
@@ -20,11 +20,19 @@ We have chosen to use some features of the recent C++17
20
20
language standard in f18.
21
21
The most important of these are:
22
22
* sum types (discriminated unions) in the form of ` std::variant `
23
+ * ` using ` template parameter packs
24
+ * generic lambdas with ` auto ` argument types
23
25
* product types in the form of ` std::tuple `
24
26
* ` std::optional `
25
27
28
+ (` std::tuple ` is actually a C++11 feature, but I include it
29
+ in this list because it's not particularly well known.)
30
+
26
31
### Sum types
27
32
33
+ First, some background information to explain the need for sum types
34
+ in f18.
35
+
28
36
Fortran is notoriously problematic to lex and parse, as tokenization
29
37
depends on the state of the partial parse;
30
38
the language has no reserved words in the sense that C++ does.
@@ -85,7 +93,8 @@ of the possibilities, and f18 will fail to build if one is missing.
85
93
86
94
Were we unable to use ` std::variant ` directly, we would likely
87
95
have chosen to implement a local ` SumType ` replacement; in the
88
- absence of C++17's ability of ` using ` a template parameter pack,
96
+ absence of C++17's abilities of ` using ` a template parameter pack
97
+ and allowing ` auto ` arguments in anonymous lambda functions,
89
98
it would be less convenient to use.
90
99
91
100
The other options for polymorphism in C++ at the level of C++11
0 commit comments