fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. #include <functional>
  4.  
  5. struct A {
  6. const std::string& s;
  7. A(const std::string& s) : s(s) {}
  8. // A(std::reference_wrapper<const std::string> r) : s(r.get()) {}
  9. };
  10.  
  11. int main() {
  12. A a("abc");
  13. std::cout << a.s << std::endl;
  14. return 0;
  15. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout