fork(2) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class
  6. {
  7. public:
  8. auto operator + () -> decltype(*this)
  9. {
  10. cout << "Unary plus\n";
  11. return *this;
  12. }
  13.  
  14. static void do_smth()
  15. {
  16. cout << "Static method\n";
  17. }
  18.  
  19. void test(auto obj)
  20. {
  21. cout << "Argument\n";
  22. }
  23. } smth;
  24.  
  25. int main()
  26. {
  27. +smth;
  28. decltype(smth) b;
  29. +b;
  30. decltype(b)::do_smth();
  31. smth.test(b);
  32.  
  33. return 0;
  34. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
Unary plus
Unary plus
Static method
Argument