Skip to content

Commit ed87afa

Browse files
committed
Fixes invalid C++ code
1 parent 5d1d0c6 commit ed87afa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/understanding-generics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,8 @@ will work in C++ but the naïve equivalent in Slang will not compile.
304304
```cpp
305305
// This function will compile when instantiated at a type which supports the +
306306
// operator. However this restriction is only discovered at the call site.
307-
template<T>
308-
float addValue(T v0, T v1) { return v0.x + v1.x; }
307+
template<typename T>
308+
float addValue(T v0, T v1) { return v0 + v1; }
309309
310310
// We happen to call `addValue` with a type that supports addition.
311311
void user() {addValue(1,2); }

0 commit comments

Comments
 (0)