Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include <vector>
- #include <thread>
- int main()
- {
- std::string foo="Hello, World";
- std::vector<std::thread> threads;
- for(auto x:foo)
- threads.push_back
- (
- std::thread
- (
- [](char c)
- {
- while(true)
- std::cout<<'\t'<<c;
- }
- ,
- x
- )
- );
- for(auto& x:threads)x.join();//Won't reach here, though!
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment