Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/** assign - assigns a value to all array elements
* usage: short arr[77]; assign(arr,88);
* License: MIT */
template<typename T, size_t N, typename V>
static inline void assign(T (&a)[N], V v) noexcept {
for(size_t i=0; i<N; ++i) a[i] = v;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.