Advertisement
Guest User

Untitled

a guest
May 26th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.04 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. //    ParallelLoopBodyWrapper() {};
  16.     ~ParallelLoopBodyWrapper(){};
  17.  
  18.     void operator()(const int& n) const{
  19.         hpx::cout << "PLBW!" << std::endl;
  20.     }
  21. };
  22.  
  23. int main()
  24. {
  25.     // Say hello to the world!
  26.     hpx::cout << "Hello World!\n" << hpx::flush;
  27.  
  28.     hpx::parallel::for_loop_strided(
  29.             hpx::parallel::execution::par, 0, 10, 1,
  30.             [&](std::size_t i) {
  31.                 hpx::cout << "i = " << i << std::endl;
  32.             });
  33.  
  34.     ParallelLoopBody *PLBW_ptr = new ParallelLoopBodyWrapper();
  35.       // Executes operator() from PLBW
  36. //    hpx::parallel::for_loop_strided(
  37. //            hpx::parallel::execution::par, 0, 500, 1,
  38. //            ?WHAT_HERE?);
  39.  
  40.     return 0;
  41. }
  42. //]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement