You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use '<thing> template' i.s.o. 'template <thing>' (isocpp#1631)
* Use '<thing> template' i.s.o. 'template <thing>'
The word 'template' is often wrongly used as an adjective to the 'thing'
it becomes when instantiated.
* Expand succinct formulation for readability
Co-authored-by: Kristoffel Pirard <kristoffel.pirard@vanhool.com>
Copy file name to clipboardExpand all lines: CppCoreGuidelines.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1277,7 +1277,7 @@ What if the connection goes down so that no logging output is produced? See I.??
1277
1277
Note that non-`const` member functions pass information to other member functions through their object's state.
1278
1278
1279
1279
**Alternative formulation**: An interface should be a function or a set of functions.
1280
-
Functions can be template functions and sets of functions can be classes or class templates.
1280
+
Functions can be function templates and sets of functions can be classes or class templates.
1281
1281
1282
1282
##### Enforcement
1283
1283
@@ -2663,7 +2663,7 @@ Member functions defined in-class are `inline` by default.
2663
2663
2664
2664
##### Exception
2665
2665
2666
-
Template functions (incl. template member functions) are normally defined in headers and therefore inline.
2666
+
Function templates (including member functions of class templates `A<T>::function()` and member function templates `A::function<T>()`) are normally defined in headers and therefore inline.
2667
2667
2668
2668
##### Enforcement
2669
2669
@@ -4124,7 +4124,7 @@ For example, we can now change the representation of a `Date` without affecting
4124
4124
##### Note
4125
4125
4126
4126
Using a class in this way to represent the distinction between interface and implementation is of course not the only way.
4127
-
For example, we can use a set of declarations of freestanding functions in a namespace, an abstract base class, or a template function with concepts to represent an interface.
4127
+
For example, we can use a set of declarations of freestanding functions in a namespace, an abstract base class, or a function template with concepts to represent an interface.
4128
4128
The most important issue is to explicitly distinguish between an interface and its implementation "details."
4129
4129
Ideally, and typically, an interface is far more stable than its implementation(s).
4130
4130
@@ -8079,7 +8079,7 @@ See [C.146](#Rh-dynamic_cast) and ???
8079
8079
8080
8080
## <a name="SS-overload"></a>C.over: Overloading and overloaded operators
8081
8081
8082
-
You can overload ordinary functions, template functions, and operators.
8082
+
You can overload ordinary functions, function templates, and operators.
8083
8083
You cannot overload function objects.
8084
8084
8085
8085
Overload rule summary:
@@ -10335,7 +10335,7 @@ Flag variable and constant declarations with multiple declarators (e.g., `int* p
10335
10335
10336
10336
* Simple repetition is tedious and error-prone.
10337
10337
* When you use `auto`, the name of the declared entity is in a fixed position in the declaration, increasing readability.
10338
-
* In a template function declaration the return type can be a member type.
10338
+
* In a function template declaration the return type can be a member type.
10339
10339
10340
10340
##### Example
10341
10341
@@ -17943,7 +17943,7 @@ Some people found the idea that the `Link` no longer was hidden inside the list
17943
17943
##### Note
17944
17944
17945
17945
A more general version of this rule would be
17946
-
"If a template class member depends on only N template parameters out of M, place it in a base class with only N parameters."
17946
+
"If a class template member depends on only N template parameters out of M, place it in a base class with only N parameters."
17947
17947
For N == 1, we have a choice of a base class of a class in the surrounding scope as in [T.61](#Rt-scary).
0 commit comments