Skip to content

Commit bf2eca6

Browse files
authored
Tutorial generics typos (#175)
Just two small typo fixes.
1 parent c3b308e commit bf2eca6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/understanding-generics.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,14 +298,14 @@ Benefits of Slang's approach:
298298
what methods are valid for generic types, unlike C++ template parameters.
299299
300300
There are certain things which work with C++ style templates, which are
301-
(deliberatly) disallowed with Slang generics. For example the following code
301+
(deliberately) disallowed with Slang generics. For example the following code
302302
will work in C++ but the naïve equivalent in Slang will not compile.
303303
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)