C++14: Remove unused make_unique.h

Also removes header references now that we are in C++14, this is
built-in to the std
This commit is contained in:
Seth Hillbrand 2019-08-06 21:26:33 -07:00
parent 4e90b2d48b
commit 5151cd0bfe
14 changed files with 10 additions and 116 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2017 Chris Pavlina <pavlina.chris@gmail.com>
* Copyright (C) 2015-2017 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -26,7 +26,6 @@
#include <wx/log.h>
#include <wx/tokenzr.h>
#include <climits>
#include <make_unique.h>
bool EDA_PATTERN_MATCH_SUBSTR::SetPattern( const wxString& aPattern )
{

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@ -19,7 +19,6 @@
*/
#include <footprint_filter.h>
#include <make_unique.h>
#include <stdexcept>
using FOOTPRINT_FILTER_IT = FOOTPRINT_FILTER::ITERATOR;

View File

@ -38,8 +38,6 @@
#include <md5_hash.h>
#include <map>
#include <make_unique.h>
#include <geometry/geometry_utils.h>
#include <geometry/shape.h>
#include <geometry/shape_line_chain.h>

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com>
* Copyright (C) 2014 Henner Zeller <h.zeller@acm.org>
* Copyright (C) 2014-2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2014-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@ -23,7 +23,6 @@
#include <eda_pattern_match.h>
#include <lib_tree_item.h>
#include <make_unique.h>
#include <utility>
#include <pgm_base.h>
#include <kicad_string.h>

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
* Copyright (C) 2013-2015 CERN
* Copyright (C) 2012-2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2012-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch>
@ -28,7 +28,6 @@
#include <view/zoom_controller.h>
#include <make_unique.h>
#include <trace_helpers.h>
#include <wx/log.h>
@ -131,4 +130,4 @@ double CONSTANT_ZOOM_CONTROLLER::GetScaleForRotation( int aRotation )
constexpr ACCELERATING_ZOOM_CONTROLLER::TIMEOUT ACCELERATING_ZOOM_CONTROLLER::DEFAULT_TIMEOUT;
constexpr double CONSTANT_ZOOM_CONTROLLER::MAC_SCALE;
constexpr double CONSTANT_ZOOM_CONTROLLER::GTK3_SCALE;
constexpr double CONSTANT_ZOOM_CONTROLLER::GTK3_SCALE;

View File

@ -23,11 +23,9 @@
#include <widgets/wx_busy_indicator.h>
#include <make_unique.h>
#include <wx/cursor.h>
WX_BUSY_INDICATOR::WX_BUSY_INDICATOR() : m_cursor( std::make_unique<wxBusyCursor>() )
{
}
}

View File

@ -42,7 +42,6 @@
#include <html_messagebox.h>
#include <reporter.h>
#include <bom_plugins.h>
#include <make_unique.h>
#include <dialogs/dialog_bom_cfg_lexer.h>

View File

@ -45,9 +45,6 @@
#include <atomic>
#include <memory>
// C++11 "polyfill" for the C++14 std::make_unique function
#include "make_unique.h"
class wxAboutDialogInfo;
class SEARCH_STACK;
class REPORTER;

View File

@ -1,88 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file make_unique.h
* @brief Implementation of std::make_unique for pre C++14 compilation
* environments
*/
#ifndef MAKE_UNIQUE_H
#define MAKE_UNIQUE_H
// Define std::make_unique if the compiler is C++11, but not C++14
// (which provides this itself)
// When C++14 support is a KiCad pre-requisite, this entire file
// can be removed.
#if __cplusplus == 201103L
#include <cstddef>
#include <memory>
#include <type_traits>
#include <utility>
// It's a bit naughty to add things to std::, but the point is to
// "polyfill" this function in only if std:: doesn't have it
//
// This implementation is the one proposed by Stephan T. Lavavej
// in N3656: https://isocpp.org/files/papers/N3656.txt
// This is more or less exactly how it is implemented in GCC (e.g. 6.3.1)
// when C++14 is enabled.
namespace std
{
template<class T> struct _Unique_if {
typedef unique_ptr<T> _Single_object;
};
template<class T> struct _Unique_if<T[]> {
typedef unique_ptr<T[]> _Unknown_bound;
};
template<class T, size_t N> struct _Unique_if<T[N]> {
typedef void _Known_bound;
};
/// std::make_unique for single objects
template<class T, class... Args>
typename _Unique_if<T>::_Single_object
make_unique(Args&&... args) {
return unique_ptr<T>(new T(std::forward<Args>(args)...));
}
/// std::make_unique for arrays of unknown bound
template<class T>
typename _Unique_if<T>::_Unknown_bound
make_unique(size_t n) {
typedef typename remove_extent<T>::type U;
return unique_ptr<T>(new U[n]());
}
/// Disable std::make_unique for arrays of known bound
template<class T, class... Args>
typename _Unique_if<T>::_Known_bound
make_unique(Args&&...) = delete;
}
#endif // __cplusplus == 201103L
#endif // WXSTRUCT_H_

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 Mark Roszko <mark.roszko@gmail.com>
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -28,7 +28,6 @@
#include <wx/file.h>
#include <macros.h>
#include <make_unique.h>
namespace SEXPR
{

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2011 Jean-Pierre Charras, <jp.charras@wanadoo.fr>
* Copyright (C) 2013-2016 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@ -33,7 +33,6 @@
#include <kiway.h>
#include <lib_id.h>
#include <macros.h>
#include <make_unique.h>
#include <pgm_base.h>
#include <wildcards_and_files_ext.h>
#include <widgets/progress_reporter.h>

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016-2017 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2016-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com>
* Copyright (C) 2016 Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
@ -32,7 +32,6 @@
#include <mutex>
#include <eda_draw_frame.h>
#include <utility>
#include <make_unique.h>
#include <colors_design_settings.h>
#include <pcb_edit_frame.h>
#include <wx/stattext.h>

View File

@ -38,7 +38,6 @@
#include <kiface_ids.h>
#include <confirm.h>
#include <macros.h>
#include <make_unique.h>
#include <pcb_edit_frame.h>
#include <eda_dde.h>
#include <wx/stdpaths.h>

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2018-2019 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -35,8 +35,6 @@
// Code under test
#include <lib_table_base.h>
#include <make_unique.h>
/**
* A concrete implementation of #LIB_TABLE_ROW that implements