[Doc] Use proper memory management in C++ examples

This commit is contained in:
Ray Speth 2016-02-01 19:23:44 -05:00
parent a374d8b0fe
commit 28156cc511
2 changed files with 3 additions and 2 deletions

View file

@ -18,7 +18,8 @@ prints its temperature is shown below:
int main(int argc, char** argv)
{
Cantera::ThermoPhase* gas = Cantera::newPhase("h2o2.cti","ohmech");
std::unique_ptr<Cantera::ThermoPhase> gas(
Cantera::newPhase("h2o2.cti", "ohmech"));
std::cout << gas->temperature() << std::endl;
return 0;
}

View file

@ -4,7 +4,7 @@ using namespace Cantera;
void thermo_demo(const std::string& file, const std::string& phase)
{
ThermoPhase* gas = newPhase(file, phase);
shared_ptr<ThermoPhase> gas(newPhase(file, phase));
gas->setState_TPX(1500.0, 2.0*OneAtm, "O2:1.0, H2:3.0, AR:1.0");
// temperature, pressure, and density