Skip to content

Commit d9885ae

Browse files
TylerMSFTTylerMSFT
authored andcommitted
cleanup
1 parent 23f3b3c commit d9885ae

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

docs/cpp/if-else-statement-cpp.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ int main()
102102

103103
Output:
104104

105-
```cmd
105+
```output
106106
x < 11 is true!
107107
25
108108
```
@@ -158,7 +158,7 @@ int main()
158158
159159
Output:
160160
161-
```cmd
161+
```Output
162162
ten
163163
x is 42
164164
setting shared_flag to false
@@ -180,7 +180,7 @@ This example shows how you can conditionally compile a template based on the typ
180180
template<typename T>
181181
auto Show(T t)
182182
{
183-
//if (std::is_pointer_v<T>) // Given Show(a), results in compiler error for return *t
183+
//if (std::is_pointer_v<T>) // Show(a) results in compiler error for return *t. Show(b) results in compiler error for return t.
184184
if constexpr (std::is_pointer_v<T>) // This statement goes away for Show(a)
185185
{
186186
return *t;
@@ -208,7 +208,8 @@ The **`if constexpr`** statement is evaluated at compile time, and the compiler
208208
Using `if constexpr` solves this problem because only the statement that matches the type of the argument sent to the function template is compiled.
209209
210210
Output:
211-
```cmd
211+
212+
```output
212213
42
213214
42
214215
```

0 commit comments

Comments
 (0)