Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
pack expansion
//clang 3.7.0 #include <iostream> #include <utility> template <typename T> int newLine(T) { std::wcout << std::endl; return 0; } template <size_t... Pack> void expandPack(std::index_sequence<Pack...>) { int dummy[sizeof...(Pack)] = { newLine(Pack)... }; } template <size_t N> void generateNewLines() { return expandPack(std::make_index_sequence<N>{}); } int main() { std::cout << "Hello, world!"; generateNewLines<5>(); std::cout << "Hello, world!"; }
run
|
edit
|
history
|
help
0
hello,world !ssn2019
HerbSutter-Virtuality
Bubble Sort Example
10 naturalnumbers
Unlike C (even C99/C11), C++ allows initializers in if-conditions, so this compiles.
program_4
problem_name_4
void pointer
ArrayList Example Starter Code 2
even number