manasij7479

Hello World !

Jul 22nd, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include<iostream>
  2. #include <vector>
  3. #include <thread>
  4. int main()
  5. {
  6.     std::string foo="Hello, World";
  7.     std::vector<std::thread> threads;
  8.     for(auto x:foo)
  9.         threads.push_back
  10.         (
  11.             std::thread
  12.             (
  13.                 [](char c)
  14.                 {
  15.                     while(true)
  16.                         std::cout<<'\t'<<c;
  17.                 }
  18.                 ,
  19.                 x
  20.             )
  21.         );
  22.     for(auto& x:threads)x.join();//Won't reach here, though!
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment