fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct foo
  5. {
  6. std::string &str;
  7. foo(std::string &other) : str(other) {}
  8.  
  9. void operator()(std::string &some) const
  10. {
  11. str += some;
  12. }
  13. };
  14.  
  15. int main()
  16. {
  17. std::string ext("Hello");
  18. foo a{ ext };
  19.  
  20. std::string more(" world!");
  21. a(more);
  22.  
  23. cout << a.str;
  24. return 0;
  25. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
Hello world!