qemu-arm 快速驗證arm應用程式
#include <iostream>
#include <memory>
using namespace std;
class Example
{
public:
Example() : e(1)
{
cout << "Example Constructor..." << endl;
}
~Example()
{
cout << "Example Destructor..." << endl;
}
int e;
};
int main()
{
shared_ptr<Example> pInt(new Example());
cout << (*pInt).e << endl;
cout << "pInt引用計數: " << pInt.use_count() << endl;
shared_ptr<Example> pInt2 = pInt;
cout << "pInt引用計數: " << pInt.use_count() << endl;
cout << "pInt2引用計數: " << pInt2.use_count() << endl;
}
arm-linux-gnueabi-g++ -std=c++11 -o test test.cpp -static
qemu-arm ./test
Example Constructor...
1
pInt引用計數: 1
pInt引用計數: 2
pInt2引用計數: 2
Example Destructor...