#include#include "CSmartPtr.h" int main() { CSmartPtr pInt(new int(5)); std::cout << *pInt << std::endl; return 0; }
#includeIn this example, a new array of integers is created using the 'new' operator. An instance of CSmartPtr class is then created to manage the memory of this array. The array is initialized with values using a for loop. The values are then printed to the console using the std::cout statement. Package library: CSmartPtr is a part of the Boost C++ library.#include "CSmartPtr.h" int main() { CSmartPtr pIntArray(new int[5]); for(int i=0; i<5; i++) { pIntArray[i] = i+1; std::cout << pIntArray[i] << std::endl; } return 0; }