Top 1,000 Features Creators Events Podcasts Extensions Interviews Blog Explorer CSV

Templates

< >
Example from 1 languages: C++
template <int length> Vector<length>& Vector<length>::operator+=(const Vector<length>& rhs) { for (int i = 0; i < length; ++i) value[i] += rhs.value[i]; return *this; }
Example from 1 languages: Nim
# https://hookrace.net/blog/introduction-to-metaprogramming-in-nim/#templates template debug*(args: varargs[string, `$`]) = if logLevel <= Level.debug: const module = instantiationInfo().filename[0 .. ^5] echo "[$# $#][$#]: $#" % [getDateStr(), getClockStr(), module, join args]
Example from 1 languages: D
template TCopy(T) { void copy(out T to, T from) { to = from; } } int i; TCopy!(int).copy(i, 3);
*

Languages with Templates include C++, Nim, D, XL

*

Languages without Templates include C, Speedie

*

View all concepts with or missing a hasTemplates measurement

*

Read more about Templates on the web: 1.

View source

- Build the next great programming language About Resources Acknowledgements Part of the World Wide Scroll