← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH 3/3] C++11: replace std::auto_ptr

 

Please do *not* commit any patches for C++ 0x11.  Using C++ 0x11 is not
an option at this point.  We still have to support older compilers that
do not support 0x11.  I do not want to abandoned a large segment of our
user base.

On 3/6/2015 5:28 AM, Simon Richter wrote:
> ---
>  common/fp_lib_table.cpp        | 2 +-
>  common/project.cpp             | 2 +-
>  eeschema/lib_export.cpp        | 8 ++++----
>  pcbnew/gpcb_plugin.cpp         | 2 +-
>  pcbnew/legacy_plugin.cpp       | 2 +-
>  pcbnew/router/pns_topology.cpp | 8 ++++----
>  6 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/common/fp_lib_table.cpp b/common/fp_lib_table.cpp
> index 3b7f7e5..dde6a41 100644
> --- a/common/fp_lib_table.cpp
> +++ b/common/fp_lib_table.cpp
> @@ -193,7 +193,7 @@ FP_LIB_TABLE::SAVE_T FP_LIB_TABLE::FootprintSave( const wxString& aNickname, con
>  
>          wxString fpname = aFootprint->GetFPID().GetFootprintName();
>  
> -        std::auto_ptr<MODULE>   m( row->plugin->FootprintLoad( row->GetFullURI( true ), fpname, row->GetProperties() ) );
> +        std::unique_ptr<MODULE>   m( row->plugin->FootprintLoad( row->GetFullURI( true ), fpname, row->GetProperties() ) );
>  
>          if( m.get() )
>              return SAVE_SKIPPED;
> diff --git a/common/project.cpp b/common/project.cpp
> index 27f91a8..8bf0120 100644
> --- a/common/project.cpp
> +++ b/common/project.cpp
> @@ -317,7 +317,7 @@ void PROJECT::ConfigSave( const SEARCH_STACK& aSList, const wxString& aGroupName
>  bool PROJECT::ConfigLoad( const SEARCH_STACK& aSList, const wxString&  aGroupName,
>          const PARAM_CFG_ARRAY& aParams, const wxString& aForeignProjectFileName )
>  {
> -    std::auto_ptr<wxConfigBase> cfg( configCreate( aSList, aGroupName, aForeignProjectFileName ) );
> +    std::unique_ptr<wxConfigBase> cfg( configCreate( aSList, aGroupName, aForeignProjectFileName ) );
>  
>      if( !cfg.get() )
>      {
> diff --git a/eeschema/lib_export.cpp b/eeschema/lib_export.cpp
> index 022e467..23a7d40 100644
> --- a/eeschema/lib_export.cpp
> +++ b/eeschema/lib_export.cpp
> @@ -57,12 +57,12 @@ void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent& event )
>  
>      wxFileName  fn = dlg.GetPath();
>  
> -    std::auto_ptr<PART_LIB> lib;
> +    std::unique_ptr<PART_LIB> lib;
>  
>      try
>      {
> -        std::auto_ptr<PART_LIB> new_lib( PART_LIB::LoadLibrary( fn.GetFullPath() ) );
> -        lib = new_lib;
> +        std::unique_ptr<PART_LIB> new_lib( PART_LIB::LoadLibrary( fn.GetFullPath() ) );
> +        lib = std::move(new_lib);
>      }
>      catch( const IO_ERROR& ioe )
>      {
> @@ -126,7 +126,7 @@ void LIB_EDIT_FRAME::OnExportPart( wxCommandEvent& event )
>  
>      fn = dlg.GetPath();
>  
> -    std::auto_ptr<PART_LIB> temp_lib( new PART_LIB( LIBRARY_TYPE_EESCHEMA, fn.GetFullPath() ) );
> +    std::unique_ptr<PART_LIB> temp_lib( new PART_LIB( LIBRARY_TYPE_EESCHEMA, fn.GetFullPath() ) );
>  
>      SaveOnePart( temp_lib.get() );
>  
> diff --git a/pcbnew/gpcb_plugin.cpp b/pcbnew/gpcb_plugin.cpp
> index 97c6804..1af1421 100644
> --- a/pcbnew/gpcb_plugin.cpp
> +++ b/pcbnew/gpcb_plugin.cpp
> @@ -388,7 +388,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader ) throw( IO_ERROR,
>      wxPoint               textPos;
>      wxString              msg;
>      wxArrayString         parameters;
> -    std::auto_ptr<MODULE> module( new MODULE( NULL ) );
> +    std::unique_ptr<MODULE> module( new MODULE( NULL ) );
>  
>  
>      if( aLineReader->ReadLine() == NULL )
> diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp
> index ecc1d66..bf50297 100644
> --- a/pcbnew/legacy_plugin.cpp
> +++ b/pcbnew/legacy_plugin.cpp
> @@ -4353,7 +4353,7 @@ void LP_CACHE::LoadModules( LINE_READER* aReader )
>          // test first for the $MODULE, even before reading because of INDEX bug.
>          if( TESTLINE( "$MODULE" ) )
>          {
> -            auto_ptr<MODULE>    module( new MODULE( m_owner->m_board ) );
> +            std::unique_ptr<MODULE>    module( new MODULE( m_owner->m_board ) );
>  
>              std::string         footprintName = StrPurge( line + SZ( "$MODULE" ) );
>  
> diff --git a/pcbnew/router/pns_topology.cpp b/pcbnew/router/pns_topology.cpp
> index f59a0fd..87f3ac5 100644
> --- a/pcbnew/router/pns_topology.cpp
> +++ b/pcbnew/router/pns_topology.cpp
> @@ -36,14 +36,14 @@ bool PNS_TOPOLOGY::SimplifyLine( PNS_LINE* aLine )
>          return false;
>  
>      PNS_SEGMENT* root = ( *aLine->LinkedSegments() )[0];
> -    std::auto_ptr<PNS_LINE> l( m_world->AssembleLine( root ) );
> +    std::unique_ptr<PNS_LINE> l( m_world->AssembleLine( root ) );
>      SHAPE_LINE_CHAIN simplified( l->CLine() );
>  
>      simplified.Simplify();
>  
>      if( simplified.PointCount() != l->PointCount() )
>      {
> -        std::auto_ptr<PNS_LINE> lnew( l->Clone() );
> +        std::unique_ptr<PNS_LINE> lnew( l->Clone() );
>          m_world->Remove( l.get() );
>          lnew->SetShape( simplified );
>          m_world->Add( lnew.get() );
> @@ -359,8 +359,8 @@ bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair )
>      if( !coupledSeg )
>          return false;
>  
> -    std::auto_ptr<PNS_LINE> lp ( m_world->AssembleLine( refSeg ) );
> -    std::auto_ptr<PNS_LINE> ln ( m_world->AssembleLine( coupledSeg ) );
> +    std::unique_ptr<PNS_LINE> lp ( m_world->AssembleLine( refSeg ) );
> +    std::unique_ptr<PNS_LINE> ln ( m_world->AssembleLine( coupledSeg ) );
>  
>      if( DpNetPolarity( refNet ) < 0 )
>      {
> 



Follow ups

References