File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -298,14 +298,14 @@ Benefits of Slang's approach:
298298 what methods are valid for generic types, unlike C++ template parameters.
299299
300300There 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
302302will 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.
311311void user() {addValue(1,2); }
You can’t perform that action at this time.
0 commit comments