Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include <vexcl/vexcl.hpp>
  2.  
  3. const vex::Context& ctx() {
  4. // This is a local static variable, so it will only be created and
  5. // initializaed once.
  6. // Moving it into a function makes sure it will only be created when needed
  7. // (at the first call to the function).
  8. static vex::Context ctx(vex::Filter::Env);
  9. return ctx;
  10. }
  11.  
  12. int main() {
  13. vex::vector<int> x(ctx(), 16);
  14. x = 42;
  15. std::cout << x << std::endl;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement