From 28156cc51155e169dd846bae239ef16fe965a1e9 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Mon, 1 Feb 2016 19:23:44 -0500 Subject: [PATCH] [Doc] Use proper memory management in C++ examples --- doc/sphinx/cxx-guide/thermo.rst | 3 ++- doc/sphinx/cxx-guide/thermodemo.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/sphinx/cxx-guide/thermo.rst b/doc/sphinx/cxx-guide/thermo.rst index 0813c89e4..eb5d39893 100644 --- a/doc/sphinx/cxx-guide/thermo.rst +++ b/doc/sphinx/cxx-guide/thermo.rst @@ -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 gas( + Cantera::newPhase("h2o2.cti", "ohmech")); std::cout << gas->temperature() << std::endl; return 0; } diff --git a/doc/sphinx/cxx-guide/thermodemo.cpp b/doc/sphinx/cxx-guide/thermodemo.cpp index d92ec2a42..79d66fc7c 100644 --- a/doc/sphinx/cxx-guide/thermodemo.cpp +++ b/doc/sphinx/cxx-guide/thermodemo.cpp @@ -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 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