From e131766b7188c32c11c48a5ad1f52022d7e48971 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Thu, 10 Sep 2015 17:28:17 -0400 Subject: [PATCH] Replace auto_ptr with unique_ptr auto_ptr is deprecated in c++11 --- doc/sphinx/cxx-guide/demoequil.cpp | 2 +- include/cantera/equil/ChemEquil.h | 2 +- samples/cxx/demo.cpp | 2 +- samples/cxx/flamespeed/flamespeed.cpp | 4 ++-- src/base/application.cpp | 2 +- src/base/application.h | 2 +- .../VCSnonideal/LatticeSolid_LiSi/latsol.cpp | 6 +++--- .../dustyGasTransport/dustyGasTransportTest.cpp | 4 ++-- .../simpleTransport/simpleTransportTest.cpp | 2 +- .../stoichSolidKinetics/stoichSolidKinetics.cpp | 16 ++++++++-------- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/doc/sphinx/cxx-guide/demoequil.cpp b/doc/sphinx/cxx-guide/demoequil.cpp index 551082e94..4a9df4e5e 100644 --- a/doc/sphinx/cxx-guide/demoequil.cpp +++ b/doc/sphinx/cxx-guide/demoequil.cpp @@ -4,7 +4,7 @@ using namespace Cantera; void equil_demo() { - std::auto_ptr gas(newPhase("h2o2.cti","ohmech")); + std::unique_ptr gas(newPhase("h2o2.cti","ohmech")); gas->setState_TPX(1500.0, 2.0*OneAtm, "O2:1.0, H2:3.0, AR:1.0"); gas->equilibrate("TP"); std::cout << gas->report() << std::endl; diff --git a/include/cantera/equil/ChemEquil.h b/include/cantera/equil/ChemEquil.h index bdb7f12b1..042b9915e 100644 --- a/include/cantera/equil/ChemEquil.h +++ b/include/cantera/equil/ChemEquil.h @@ -275,7 +275,7 @@ protected: */ size_t m_nComponents; - std::auto_ptr > m_p1, m_p2; + std::unique_ptr > m_p1, m_p2; /** * Current value of the mole fractions in the single phase. diff --git a/samples/cxx/demo.cpp b/samples/cxx/demo.cpp index fbb10b12e..7a23b4e81 100644 --- a/samples/cxx/demo.cpp +++ b/samples/cxx/demo.cpp @@ -87,7 +87,7 @@ void demoprog() // create a transport manager for the gas that computes // mixture-averaged properties - std::auto_ptr tr(newTransportMgr("Mix", &gas, 1)); + std::unique_ptr tr(newTransportMgr("Mix", &gas, 1)); // print the viscosity, thermal conductivity, and diffusion // coefficients diff --git a/samples/cxx/flamespeed/flamespeed.cpp b/samples/cxx/flamespeed/flamespeed.cpp index 75eba82f9..b390c5137 100644 --- a/samples/cxx/flamespeed/flamespeed.cpp +++ b/samples/cxx/flamespeed/flamespeed.cpp @@ -84,8 +84,8 @@ int flamespeed(double phi) // specify the objects to use to compute kinetic rates and // transport properties - std::auto_ptr trmix(newTransportMgr("Mix", &gas)); - std::auto_ptr trmulti(newTransportMgr("Multi", &gas)); + std::unique_ptr trmix(newTransportMgr("Mix", &gas)); + std::unique_ptr trmulti(newTransportMgr("Multi", &gas)); flow.setTransport(*trmix); flow.setKinetics(gas); diff --git a/src/base/application.cpp b/src/base/application.cpp index 0c80c1a94..3dc6eea70 100644 --- a/src/base/application.cpp +++ b/src/base/application.cpp @@ -166,7 +166,7 @@ Application::Application() : m_suppress_deprecation_warnings(false) { #if !defined( THREAD_SAFE_CANTERA ) - pMessenger = std::auto_ptr(new Messages()); + pMessenger = std::unique_ptr(new Messages()); #endif // install a default logwriter that writes to standard diff --git a/src/base/application.h b/src/base/application.h index a750ac811..be4bd4d25 100644 --- a/src/base/application.h +++ b/src/base/application.h @@ -388,7 +388,7 @@ protected: #if defined(THREAD_SAFE_CANTERA) ThreadMessages pMessenger; #else - std::auto_ptr pMessenger; + std::unique_ptr pMessenger; #endif private: diff --git a/test_problems/VCSnonideal/LatticeSolid_LiSi/latsol.cpp b/test_problems/VCSnonideal/LatticeSolid_LiSi/latsol.cpp index d69f639dd..199c2d624 100644 --- a/test_problems/VCSnonideal/LatticeSolid_LiSi/latsol.cpp +++ b/test_problems/VCSnonideal/LatticeSolid_LiSi/latsol.cpp @@ -16,9 +16,9 @@ void testProblem() vcs_timing_print_lvl = 0; // Create the phases - std::auto_ptr LiSi_solid(newPhase("Li7Si3_ls.xml", - "Li7Si3_and_Interstitials(S)")); - std::auto_ptr Li_liq(newPhase("Li_Liquid.xml", "Li(L)")); + std::unique_ptr LiSi_solid(newPhase("Li7Si3_ls.xml", + "Li7Si3_and_Interstitials(S)")); + std::unique_ptr Li_liq(newPhase("Li_Liquid.xml", "Li(L)")); FixedChemPotSSTP LiFixed("Li", -2.3E7); MargulesVPSSTP salt("LiKCl_liquid.xml", "MoltenSalt_electrolyte"); diff --git a/test_problems/dustyGasTransport/dustyGasTransportTest.cpp b/test_problems/dustyGasTransport/dustyGasTransportTest.cpp index 2c43051ab..c58b07a61 100644 --- a/test_problems/dustyGasTransport/dustyGasTransportTest.cpp +++ b/test_problems/dustyGasTransport/dustyGasTransportTest.cpp @@ -13,8 +13,8 @@ int main(int argc, char** argv) try { int log_level = 0; - std::auto_ptr g(newPhase("h2o2.xml")); - auto_ptr tran(newTransportMgr("DustyGas", g.get(), log_level)); + unique_ptr g(newPhase("h2o2.xml")); + unique_ptr tran(newTransportMgr("DustyGas", g.get(), log_level)); DustyGasTransport* tranDusty = dynamic_cast(tran.get()); size_t nsp = g->nSpecies(); diff --git a/test_problems/simpleTransport/simpleTransportTest.cpp b/test_problems/simpleTransport/simpleTransportTest.cpp index bf750ed2f..1d177290a 100644 --- a/test_problems/simpleTransport/simpleTransportTest.cpp +++ b/test_problems/simpleTransport/simpleTransportTest.cpp @@ -16,7 +16,7 @@ int main(int argc, char** argv) HMWSoln HMW("HMW_NaCl_pdss.xml", "NaCl_electrolyte"); - auto_ptr tran(newDefaultTransportMgr(&HMW, log_level)); + unique_ptr tran(newDefaultTransportMgr(&HMW, log_level)); SimpleTransport& tranSimple = dynamic_cast(*tran.get()); size_t nsp = HMW.nSpecies(); diff --git a/test_problems/stoichSolidKinetics/stoichSolidKinetics.cpp b/test_problems/stoichSolidKinetics/stoichSolidKinetics.cpp index 2251f05bf..b4d39ef2e 100644 --- a/test_problems/stoichSolidKinetics/stoichSolidKinetics.cpp +++ b/test_problems/stoichSolidKinetics/stoichSolidKinetics.cpp @@ -48,15 +48,15 @@ void testProblem() if (!xg) { throw CanteraError("couldn't find file", ""); } - std::auto_ptr surfTP(newPhase(*xg)); - std::auto_ptr gasTP(newPhase("gas.xml")); + unique_ptr surfTP(newPhase(*xg)); + unique_ptr gasTP(newPhase("gas.xml")); - std::auto_ptr cao_s(newPhase("solidPhases.xml", "CaO(S)")); - std::auto_ptr caco3_s(newPhase("solidPhases.xml", "CaCO3(S)")); - std::auto_ptr c_s(newPhase("solidPhases.xml", "C(S)")); - std::auto_ptr fe3o4_s(newPhase("solidPhases.xml", "Fe3O4(S)")); - std::auto_ptr feo_s(newPhase("solidPhases.xml", "FeO(S)")); - std::auto_ptr fe_s(newPhase("solidPhases.xml", "Fe(S)")); + unique_ptr cao_s(newPhase("solidPhases.xml", "CaO(S)")); + unique_ptr caco3_s(newPhase("solidPhases.xml", "CaCO3(S)")); + unique_ptr c_s(newPhase("solidPhases.xml", "C(S)")); + unique_ptr fe3o4_s(newPhase("solidPhases.xml", "Fe3O4(S)")); + unique_ptr feo_s(newPhase("solidPhases.xml", "FeO(S)")); + unique_ptr fe_s(newPhase("solidPhases.xml", "Fe(S)")); vector phaseList; phaseList.push_back(gasTP.get());