Skip to content

Commit 75964cf

Browse files
author
Colin Robertson
committed
Does that later.
1 parent 99ef6b9 commit 75964cf

1 file changed

Lines changed: 16 additions & 20 deletions

File tree

‎docs/cpp/partial-ordering-of-function-templates-cpp.md‎

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,32 +41,28 @@ The following sample works as specified in the standard:
4141
// compile with: /EHsc
4242
#include <iostream>
4343

44-
template <class T> void f(T)
45-
{
46-
printf_s("Less specialized function called\n");
44+
template <class T> void f(T) {
45+
printf_s("Less specialized function called\n");
4746
}
4847

49-
template <class T> void f(T*)
50-
{
51-
printf_s("More specialized function called\n");
48+
template <class T> void f(T*) {
49+
printf_s("More specialized function called\n");
5250
}
5351

54-
template <class T> void f(const T*)
55-
{
56-
printf_s("Even more specialized function for const T*\n");
52+
template <class T> void f(const T*) {
53+
printf_s("Even more specialized function for const T*\n");
5754
}
5855

59-
int main()
60-
{
61-
int i =0;
62-
const int j = 0;
63-
int *pi = &i;
64-
const int *cpi = &j;
65-
66-
f(i); // Calls less specialized function.
67-
f(pi); // Calls more specialized function.
68-
f(cpi); // Calls even more specialized function.
69-
// Without partial ordering, these calls would be ambiguous.
56+
int main() {
57+
int i =0;
58+
const int j = 0;
59+
int *pi = &i;
60+
const int *cpi = &j;
61+
62+
f(i); // Calls less specialized function.
63+
f(pi); // Calls more specialized function.
64+
f(cpi); // Calls even more specialized function.
65+
// Without partial ordering, these calls would be ambiguous.
7066
}
7167
```
7268

0 commit comments

Comments
 (0)