[Doc] Use proper memory management in C++ examples
This commit is contained in:
parent
a374d8b0fe
commit
28156cc511
2 changed files with 3 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue