fork download
  1. #include <iostream>
  2.  
  3. template <class T>
  4. struct lambda0{
  5. T x_;
  6. lambda0(T x) : x_(x){}
  7. void operator()(){
  8. auto y = x_;
  9. std::cout << std::boolalpha << (&x_ == &y) << std::endl;
  10. }
  11. };
  12. template <class T>
  13. void f(T x){
  14. (lambda0<T const&>(x))();
  15. }
  16. int main()
  17. {
  18. f(0);
  19. }
Success #stdin #stdout 0s 2828KB
stdin
Standard input is empty
stdout
false