Guest User

Untitled

a guest
May 26th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. #include <hpx/hpx_main.hpp>
  2. #include <hpx/include/iostreams.hpp>
  3. #include <hpx/parallel/algorithms/for_loop.hpp>
  4.  
  5. class ParallelLoopBody
  6. {
  7.     public:
  8.         virtual ~ParallelLoopBody() {};
  9.         virtual void operator() (const int& n) const = 0;
  10. };
  11.  
  12. class ParallelLoopBodyWrapper : public ParallelLoopBody
  13. {
  14.     public:
  15.  
  16.         void operator()(const int& n) const{
  17.             hpx::cout << "PLBW!" << std::endl;
  18.         }
  19. };
  20.  
  21. int main()
  22. {
  23.     // Say hello to the world!
  24.     hpx::cout << "Hello World!\n" << hpx::flush;
  25.  
  26.     hpx::parallel::for_loop_strided(
  27.             hpx::parallel::execution::par, 0, 10, 1,
  28.             [&](std::size_t i) {
  29.                 hpx::cout << "i = " << i << std::endl;
  30.             });
  31.  
  32.     ParallelLoopBodyWrapper PLBW;
  33.       // Executes operator() from PLBW
  34. //    hpx::parallel::for_loop_strided(
  35. //            hpx::parallel::execution::par, 0, 500, 1,
  36. //            ?WHAT_HERE?);
  37.  
  38.     return 0;
  39. }
  40. //]
Advertisement
Add Comment
Please, Sign In to add comment