Created
May 5, 2015 01:09
-
-
Save thiagomg/608c1e50eee63836de1d to your computer and use it in GitHub Desktop.
Do macro ao template
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
template<typename T, typename U> | |
void fill(T &t, U start, U end, U step) { | |
for(U i=start; i < end; i += step) { | |
t.push_back(i); | |
} | |
} | |
template<typename T> | |
auto accum(T &t) { | |
typename T::value_type ret{}; | |
for(auto &item : t) { | |
ret += item; | |
} | |
return ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment