[ create a new paste ] login | about

Link: http://codepad.org/w15PqPLu    [ raw code | output | fork ]

xtofl - C++, pasted on Mar 14:
struct C {
   C(){ printf("C()\n"); }
   C( const C& c ) { printf("C(C)\n"); }
};

template< typename T >
struct Initializer {
  T t;
  Initializer():t(){}
};

template< typename T >
T foo(  ){
  Initializer<T> i;
  printf( "returning\n");
  return i.t;
}

int main(){
  foo<int>();
  foo<C>();
}


Output:
1
2
3
4
returning
C()
returning
C(C)


Create a new paste based on this one


Comments: