fork download
  1. #include <iostream>
  2.  
  3. template< typename param >
  4. void same_params( param a, param b ) {
  5. std::cout << ( &a == &b ) << '\n';
  6. }
  7.  
  8. int main() {
  9. int const five = 5;
  10. same_params< int const & >( five, five ); // true
  11. same_params< int const & >( five, 6 ); // false
  12. same_params< int const & >( five, 5 ); // unspecified
  13. same_params< int const & >( 5, 5 ); // unspecified
  14.  
  15. same_params< int >( five, five ); // false (for any arguments)
  16. }
  17.  
Success #stdin #stdout 0.02s 2724KB
stdin
Standard input is empty
stdout
1
0
0
0
0