#include "Teuchos_RCP.hpp" int main(){ double *ptr = new double(3.14); Teuchos::RCPrcp = Teuchos::rcp(ptr, true); return 0; }
#include "Teuchos_RCP.hpp" void printValue(Teuchos::RCPIn this example, the RCP object is passed by value to a function. The function takes ownership of the object for the duration of the function call and releases it when it returns. Teuchos RCP is a package library for managing reference-counted objects in C++.value){ std::cout << "The value is " << *value << std::endl; } int main(){ Teuchos::RCP rcp = Teuchos::rcp(new double(3.14), true); printValue(rcp); return 0; }