#include <iostream>
#include <memory>
using namespace std;
int main()
{
std::shared_ptr<int> p1 = nullptr;
if(p1)
{
std::cout << "p1 != nullptr" << std::endl;
}
else
{
std::cout << "p1 == nullptr" << std::endl;
}
return 0;
}
g++ -std=c++11 shared_ptr_test.cpp
sxn7szh@SGHVM011035-VM:~/demo$ ./a.out
p1 == nullptr