Instantly share code, notes, and snippets.

Embed
What would you like to do?
std::array<int, 10> zs;
fill_ap(zs.begin(), zs.end(), 2, 3);
display(zs); //2 5 8 11 14 17 20 23 26 29
initial = 0;
total = std::accumulate(zs.rbegin(), zs.rend(), initial); //accumulate is fold
std::cout << total << "\n"; //155
std::vector<int> ws;
unfold_ap(total, 2, 3, std::back_inserter(ws));
display(ws); //2 5 8 11 14 17 20 23 26 29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment