Created
November 27, 2016 06:20
-
-
Save hutorny/c9340f7aa469974584d44e5eed660719 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** 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