fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. template <typename T> const T *ref_to_ptr(const T &x)
  6. {
  7. return &x;
  8. }
  9.  
  10. void print(const int *val)
  11. {
  12. cout << *val << endl;
  13. }
  14.  
  15. int main()
  16. {
  17. print(ref_to_ptr(42));
  18. return 0;
  19. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
42