關於this後,請解釋這種現象: #include <stdio.h>
struct B { B(B&) { } B() { } };
struct A {
template<typename T>
A(T&){ printf("A(T&)\n"); }
A() { }
// B b; // when this is uncommented, output c
我寫一個函數inListi(),它至少需要一個參數,第一個參數的所有後續參數THES列表進行比較。如果第一個參數==列表中的元素則返回true,否則返回false。所以: if(inListi(1.2, 2.3, 4.5, 1.2))
std::cout << "Returns true because last argument equals the first argument."