Always use std::shared_ptr

Since we compile as c++11, std::shared_ptr is guaranteed to exist.
This commit is contained in:
Ray Speth 2015-09-10 17:38:29 -04:00
parent e131766b71
commit f335350c35
17 changed files with 5 additions and 75 deletions

View file

@ -818,22 +818,6 @@ boost_version_source = get_expression_value(['<boost/version.hpp>'], 'BOOST_LIB_
retcode, boost_lib_version = conf.TryRun(boost_version_source, '.cpp')
env['BOOST_LIB_VERSION'] = boost_lib_version.strip()
# Find shared pointer implementation
configh['CT_USE_STD_SHARED_PTR'] = None
configh['CT_USE_TR1_SHARED_PTR'] = None
configh['CT_USE_MSFT_SHARED_PTR'] = None
configh['CT_USE_BOOST_SHARED_PTR'] = None
if conf.CheckStatement('std::shared_ptr<int> x', '#include <memory>'):
configh['CT_USE_STD_SHARED_PTR'] = 1
elif conf.CheckStatement('std::tr1::shared_ptr<int> x', '#include <tr1/memory>'):
configh['CT_USE_TR1_SHARED_PTR'] = 1
elif conf.CheckStatement('std::tr1::shared_ptr<int> x', '#include <memory>'):
configh['CT_USE_MSFT_SHARED_PTR'] = 1
elif conf.CheckStatement('boost::shared_ptr<int> x', '#include <boost/shared_ptr.hpp>'):
configh['CT_USE_BOOST_SHARED_PTR'] = 1
else:
config_error("Couldn't find a working shared_ptr implementation.")
import SCons.Conftest, SCons.SConf
context = SCons.SConf.CheckContext(conf)
ret = SCons.Conftest.CheckLib(context,

View file

@ -55,12 +55,6 @@ typedef int ftnlen; // Fortran hidden string length type
%(LAPACK_NAMES_LOWERCASE)s
%(LAPACK_FTN_TRAILING_UNDERSCORE)s
//--------- shared_ptr implementation ---------
%(CT_USE_STD_SHARED_PTR)s
%(CT_USE_TR1_SHARED_PTR)s
%(CT_USE_MSFT_SHARED_PTR)s
%(CT_USE_BOOST_SHARED_PTR)s
//-------- BOOST --------
%(USE_BOOST_MATH)s

View file

@ -24,6 +24,7 @@
#include <map>
#include <string>
#include <algorithm>
#include <memory>
/**
* Namespace for the Cantera kernel.
@ -36,6 +37,8 @@ namespace Cantera
#define DATA_PTR(vec) &vec[0]
#endif
using std::shared_ptr;
/*!
* All physical constants are stored here.
*

View file

@ -1,38 +0,0 @@
#ifndef CT_SMART_PTR
#define CT_SMART_PTR
#include "config.h"
#if defined CT_USE_STD_SHARED_PTR
#include <memory>
namespace Cantera
{
using std::shared_ptr;
}
#elif defined CT_USE_TR1_SHARED_PTR
#include <tr1/memory>
namespace Cantera
{
using std::tr1::shared_ptr;
}
#elif defined CT_USE_MSFT_SHARED_PTR
#include <memory>
namespace Cantera
{
using std::tr1::shared_ptr;
}
#elif defined CT_USE_BOOST_SHARED_PTR
#include <boost/shared_ptr.hpp>
namespace Cantera
{
using boost::shared_ptr;
}
#else
#error "No shared_ptr implementation available"
#endif
#endif

View file

@ -13,8 +13,6 @@
#include "cantera/base/ctexceptions.h"
#include "cantera/thermo/ThermoPhase.h"
#include <memory>
namespace Cantera
{

View file

@ -11,7 +11,6 @@
#include "cantera/base/FactoryBase.h"
#include "cantera/base/ct_thread.h"
#include "cantera/base/smart_ptr.h"
#include "cantera/kinetics/Falloff.h"
namespace Cantera

View file

@ -15,7 +15,6 @@
#include "cantera/thermo/mix_defs.h"
#include "cantera/kinetics/Reaction.h"
#include "cantera/base/global.h"
#include "cantera/base/smart_ptr.h"
namespace Cantera
{

View file

@ -6,7 +6,6 @@
#define CT_REACTION_H
#include "cantera/base/utilities.h"
#include "cantera/base/smart_ptr.h"
#include "cantera/kinetics/RxnRates.h"
#include "cantera/kinetics/Falloff.h"

View file

@ -4,7 +4,6 @@
#define CT_SPECIES_H
#include "cantera/base/ct_defs.h"
#include "cantera/base/smart_ptr.h"
namespace Cantera
{

View file

@ -10,7 +10,6 @@
#define CT_SPECIESTHERMO_H
#include "cantera/base/ct_defs.h"
#include "cantera/base/smart_ptr.h"
namespace Cantera
{

View file

@ -4,7 +4,6 @@
#define CT_TRANSPORTDATA_H
#include "cantera/base/ct_defs.h"
#include "cantera/base/smart_ptr.h"
namespace Cantera
{

View file

@ -59,8 +59,8 @@ cdef extern from "cantera/cython/funcWrapper.h":
CxxFunc1(callback_wrapper, void*)
double eval(double) except +translate_exception
cdef extern from "cantera/base/smart_ptr.h":
cppclass shared_ptr "Cantera::shared_ptr" [T]:
cdef extern from "<memory>":
cppclass shared_ptr "std::shared_ptr" [T]:
T* get()
void reset(T*)

View file

@ -7,7 +7,6 @@
#include "cantera/base/logger.h"
#include <set>
#include <memory>
namespace Cantera
{

View file

@ -6,7 +6,6 @@
#include "cantera/thermo.h"
#include <stdio.h>
#include <memory>
using namespace Cantera;

View file

@ -2,7 +2,6 @@
#include "cantera/transport.h"
#include "cantera/transport/DustyGasTransport.h"
#include <memory>
#include <cstdio>
using namespace std;

View file

@ -3,7 +3,6 @@
#include "cantera/thermo/HMWSoln.h"
#include "cantera/transport/SimpleTransport.h"
#include <memory>
#include <cstdio>
using namespace std;

View file

@ -4,7 +4,6 @@
#include "cantera/thermo/IonsFromNeutralVPSSTP.h"
#include "cantera/IdealGasMix.h"
#include <memory>
#include <iomanip>
#include <sstream>