mirror of
https://github.com/AnthonyCalandra/modern-cpp-features.git
synced 2025-12-17 10:04:35 +03:00
committed by
Anthony Calandra
parent
b0713330f2
commit
288c3b557c
2
CPP17.md
2
CPP17.md
@@ -64,7 +64,7 @@ auto seq2 = my_integer_sequence<0, 1, 2>();
|
|||||||
### Folding expressions
|
### Folding expressions
|
||||||
A fold expression performs a fold of a template parameter pack over a binary operator.
|
A fold expression performs a fold of a template parameter pack over a binary operator.
|
||||||
* An expression of the form `(... op e)` or `(e op ...)`, where `op` is a fold-operator and `e` is an unexpanded parameter pack, are called _unary folds_.
|
* An expression of the form `(... op e)` or `(e op ...)`, where `op` is a fold-operator and `e` is an unexpanded parameter pack, are called _unary folds_.
|
||||||
* An expression of the form `(e1 op ... op e2)`, where `op` are fold-operators, is called a _binary fold_. Either `e1` or `e2` are unexpanded parameter packs, but not both.
|
* An expression of the form `(e1 op ... op e2)`, where `op` are fold-operators, is called a _binary fold_. Either `e1` or `e2` is an unexpanded parameter pack, but not both.
|
||||||
```c++
|
```c++
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
bool logicalAnd(Args... args) {
|
bool logicalAnd(Args... args) {
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ auto seq2 = my_integer_sequence<0, 1, 2>();
|
|||||||
### Folding expressions
|
### Folding expressions
|
||||||
A fold expression performs a fold of a template parameter pack over a binary operator.
|
A fold expression performs a fold of a template parameter pack over a binary operator.
|
||||||
* An expression of the form `(... op e)` or `(e op ...)`, where `op` is a fold-operator and `e` is an unexpanded parameter pack, are called _unary folds_.
|
* An expression of the form `(... op e)` or `(e op ...)`, where `op` is a fold-operator and `e` is an unexpanded parameter pack, are called _unary folds_.
|
||||||
* An expression of the form `(e1 op ... op e2)`, where `op` are fold-operators, is called a _binary fold_. Either `e1` or `e2` are unexpanded parameter packs, but not both.
|
* An expression of the form `(e1 op ... op e2)`, where `op` are fold-operators, is called a _binary fold_. Either `e1` or `e2` is an unexpanded parameter pack, but not both.
|
||||||
```c++
|
```c++
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
bool logicalAnd(Args... args) {
|
bool logicalAnd(Args... args) {
|
||||||
|
|||||||
Reference in New Issue
Block a user