fork download
  1.  
  2. #include <iostream>
  3. #include <type_traits>
  4. using namespace std;
  5.  
  6. template<typename T_orig> void f(T_orig& a){
  7. a=5;
  8. }
  9.  
  10.  
  11. template<typename T_orig, typename T=T_orig&> void g(T a){
  12. a=8;
  13. }
  14.  
  15. int main() {
  16. int b=3;
  17. f<decltype(b)>(b);
  18. cout<<b<<endl;
  19. g<decltype(b)>(b);
  20. cout<<b<<endl;
  21. return 0;
  22. }
Success #stdin #stdout 0s 2884KB
stdin
Standard input is empty
stdout
5
5