Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <iostream>
- #include <vector>
- void println(std::string_view fmt, const auto& v)
- {
- for (std::cout << fmt; const auto& e : v)
- std::cout << e << ' ';
- std::cout << '\n';
- };
- int main()
- {
- std::vector<double> v(5);
- std::generate(v.begin(), v.end(), [n = 0.0] () mutable { return n+=0.1; });
- println("v: ", v);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement