fork download
  1. #include <iostream>
  2. #include <type_traits>
  3.  
  4. template <typename T>
  5. void func(T value)
  6. {
  7. if (std::is_pointer<T>::value)
  8. std::cout << "Pointer\n";
  9. else
  10. std::cout << "No Pointer\n";
  11. }
  12.  
  13. int main()
  14. {
  15. int a;
  16. int *b = &a;
  17. int &c = a;
  18.  
  19. func(a);
  20. func(b);
  21. func(c);
  22. }
  23.  
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
No Pointer
Pointer
No Pointer