Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <thread>
- using namespace std;
- // print vector to console
- void print_v(const vector<double>& x) {
- cout << "x: ";
- for (unsigned i = 0; i < x.size()-1; ++i)
- cout << x[i] << ", ";
- cout << x[x.size() - 1] << endl;
- }
- void thread_me() {
- vector<double> v;
- v.push_back(343.0);
- v.assign(10, v[0]);
- print_v(v);
- }
- // go go go
- int main() {
- for (unsigned i = 0; i < 10; ++i) {
- std::thread thread(thread_me);
- thread.join();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement