C++0x里的auto*做什么用的?# JobHunting - 待字闺中
q*x
1 楼
有auto,完全没必要用auto*啊。下面的x和y类型是一样的。
#include
#include
using namespace std;
class X {
int x;
};
int main() {
auto x = new X;
auto* y = new X;
cout << typeid(x).name() << endl;
cout << typeid(y).name() << endl;
}
#include
#include
using namespace std;
class X {
int x;
};
int main() {
auto x = new X;
auto* y = new X;
cout << typeid(x).name() << endl;
cout << typeid(y).name() << endl;
}