fork(1) download
  1. #include <iostream>
  2. #include <random>
  3.  
  4. class Sampler{
  5. private:
  6. std::mt19937 gen_;
  7.  
  8. public:
  9. Sampler();
  10. double sample();
  11. };
  12.  
  13. Sampler::Sampler() : gen_(std::random_device{}()) {}
  14.  
  15. class Foo{
  16. private:
  17. Sampler s_;
  18.  
  19. public:
  20. Foo(Sampler);
  21. };
  22.  
  23. Foo::Foo(Sampler s) : s_(s) {} // Does work
  24.  
  25. int main()
  26. {
  27. Sampler s;
  28. Foo f(s);
  29. }
Success #stdin #stdout 0s 3464KB
stdin
Standard input is empty
stdout
Standard output is empty