fork(1) download
  1. #include <iostream>
  2. #include <cstddef> // for size_t
  3.  
  4. template< typename T > class
  5. reset_impl_t;
  6.  
  7. template< typename T, ::std::size_t sz > class
  8. reset_impl_t< T(&)[sz] >
  9. {
  10. public: static void
  11. reset(T(&x)[sz])
  12. {
  13. (void) x; // not used
  14. ::std::cout << "array" << ::std::endl;
  15. }
  16. };
  17.  
  18. template< typename T > class
  19. reset_impl_t< T * >
  20. {
  21. public: static void
  22. reset(T * x)
  23. {
  24. (void) x; // not used
  25. ::std::cout << "pointer" << ::std::endl;
  26. }
  27. };
  28.  
  29. template< typename T > class
  30. reset_impl_t< T * & >
  31. {
  32. public: static void
  33. reset(T * x)
  34. {
  35. return(reset_impl_t< T * >::reset(x));
  36. }
  37. };
  38.  
  39. template< typename T > class
  40. reset_impl_t< T & >
  41. {
  42. public: static void
  43. reset(T & x)
  44. {
  45. (void) x; // not used
  46. ::std::cout << "reference" << ::std::endl;
  47. }
  48. };
  49.  
  50. template< typename T > void
  51. reset(T && x)
  52. {
  53. return(reset_impl_t< T >::reset(x));
  54. }
  55.  
  56. int main()
  57. {
  58. int nRetCode = 0;
  59.  
  60. char mass[10];
  61. char * pmass = mass;
  62.  
  63. reset(mass);
  64. reset(pmass);
  65. reset(nRetCode);
  66. return 0;
  67. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
array
pointer
reference