Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2015
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. template<typename T> struct A {};
  4. template<typename T, typename U, typename V> void f(T&, const U&, V) { std::cout << "f1\n"; } //#1
  5. template<typename T, typename U, typename V> void f(T&&, U&, A<V>) { std::cout << "f2\n"; } //#2
  6.  
  7. int main()
  8. {
  9.    int a = 7;
  10.    const char b = 'a';
  11.    A<int> c;
  12.    f(a, b, c); //Should print 'f2'.
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement