Skip to content

Commit bdf62ac

Browse files
committed
Small edits to C++17 usage notes
1 parent 5bae949 commit bdf62ac

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

documentation/C++17.md

+13-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
44

55
## C++14/17 features used in f18
66

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
88
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
1111
project.
1212
We also want to maximize portability, future-proofing,
1313
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
2020
language standard in f18.
2121
The most important of these are:
2222
* sum types (discriminated unions) in the form of `std::variant`
23+
* `using` template parameter packs
24+
* generic lambdas with `auto` argument types
2325
* product types in the form of `std::tuple`
2426
* `std::optional`
2527

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+
2631
### Sum types
2732

33+
First, some background information to explain the need for sum types
34+
in f18.
35+
2836
Fortran is notoriously problematic to lex and parse, as tokenization
2937
depends on the state of the partial parse;
3038
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.
8593

8694
Were we unable to use `std::variant` directly, we would likely
8795
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,
8998
it would be less convenient to use.
9099

91100
The other options for polymorphism in C++ at the level of C++11

0 commit comments

Comments
 (0)