Skip to content

Commit 99ef6b9

Browse files
author
Colin Robertson
committed
Sentence case. Format code.
1 parent ebff9a6 commit 99ef6b9

1 file changed

Lines changed: 23 additions & 19 deletions

File tree

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

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
title: "Partial Ordering of Function Templates (C++)"
2+
title: "Partial ordering of function templates (C++)"
33
ms.date: "07/30/2019"
44
helpviewer_keywords: ["partial ordering of function templates"]
55
ms.assetid: 0c17347d-0e80-47ad-b5ac-046462d9dc73
66
---
7-
# Partial Ordering of Function Templates (C++)
7+
# Partial ordering of function templates (C++)
88

99
Multiple function templates that match the argument list of a function call can be available. C++ defines a partial ordering of function templates to specify which function should be called. The ordering is partial because there can be some templates that are considered equally specialized.
1010

@@ -41,28 +41,32 @@ 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-
printf_s("Less specialized function called\n");
44+
template <class T> void f(T)
45+
{
46+
printf_s("Less specialized function called\n");
4647
}
4748

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

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

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.
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.
6670
}
6771
```
6872
@@ -76,4 +80,4 @@ Even more specialized function for const T*
7680

7781
## See also
7882

79-
[Function Templates](../cpp/function-templates.md)
83+
[Function templates](../cpp/function-templates.md)

0 commit comments

Comments
 (0)