Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/understanding-generics.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,14 @@ Benefits of Slang's approach:
what methods are valid for generic types, unlike C++ template parameters.

There are certain things which work with C++ style templates, which are
(deliberatly) disallowed with Slang generics. For example the following code
(deliberately) disallowed with Slang generics. For example the following code
will work in C++ but the naïve equivalent in Slang will not compile.

```cpp
// This function will compile when instantiated at a type which supports the +
// operator. However this restriction is only discovered at the call site.
template<T>
float addValue(T v0, T v1) { return v0.x + v1.x; }
template<typename T>
float addValue(T v0, T v1) { return v0 + v1; }

// We happen to call `addValue` with a type that supports addition.
void user() {addValue(1,2); }
Expand Down