- Timestamp:
- Apr 3, 2017, 2:29:04 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 6f71276
- Parents:
- 36e05a2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/generic_types/generic_types.tex
r36e05a2 r8396044 214 214 Hence, programmers can easily form new local environments to maximize reuse of existing functions and types. 215 215 216 Finally, variables may be overloaded:216 Finally, \CFA allows variable overloading: 217 217 \lstDeleteShortInline@ 218 218 \par\smallskip … … 263 263 forall( otype T | summable( T ) ) 264 264 T sum( T a[$\,$], size_t size ) { 265 T total = { 0 };$\C{// instantiate T from 0}$265 `T` total = { `0` }; $\C{// instantiate T from 0}$ 266 266 for ( unsigned int i = 0; i < size; i += 1 ) 267 total += a[i];$\C{// select appropriate +}$267 total `+=` a[i]; $\C{// select appropriate +}$ 268 268 return total; 269 269 }
Note: See TracChangeset
for help on using the changeset viewer.