Merge pull request #3537 from ab9rf/no-more-dts

replace `dts:make_unique` with `std::make_unique`
develop
Myk 2023-07-07 20:23:23 -07:00 committed by GitHub
commit 94727a0af6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 29 deletions

@ -1404,7 +1404,7 @@ Core::~Core()
}
Core::Core() :
d(dts::make_unique<Private>()),
d(std::make_unique<Private>()),
script_path_mutex{},
HotkeyMutex{},
HotkeyCond{},
@ -1501,7 +1501,7 @@ bool Core::InitMainThread() {
#else
const char * path = "hack\\symbols.xml";
#endif
auto local_vif = dts::make_unique<DFHack::VersionInfoFactory>();
auto local_vif = std::make_unique<DFHack::VersionInfoFactory>();
std::cerr << "Identifying DF version.\n";
try
{
@ -1517,7 +1517,7 @@ bool Core::InitMainThread() {
return false;
}
vif = std::move(local_vif);
auto local_p = dts::make_unique<DFHack::Process>(*vif);
auto local_p = std::make_unique<DFHack::Process>(*vif);
local_p->ValidateDescriptionOS();
vinfo = local_p->getDescriptor();

@ -61,28 +61,6 @@ namespace DFHack {
class color_ostream;
}
/*! \namespace dts
* std.reverse() == dts, The namespace that include forward compatible helpers
* which can be used from newer standards. The preprocessor check prefers
* standard version if one is available. The standard version gets imported with
* using.
*/
namespace dts {
// Check if lib supports the feature test macro or version is over c++14.
#if __cpp_lib_make_unique < 201304 && __cplusplus < 201402L
//! Insert c++14 make_unique to be forward compatible. Array versions are
//! missing
template<typename T, typename... Args>
typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T> >::type
make_unique(Args&&... args)
{
return std::unique_ptr<T>{new T{std::forward<Args>(args)...}};
}
#else /* >= c++14 */
using std::make_unique;
#endif
}
template <typename T>
void print_bits ( T val, std::ostream& out )
{

@ -44,7 +44,7 @@ using namespace DFHack;
std::unique_ptr<Module> DFHack::createGraphic()
{
return dts::make_unique<Graphic>();
return std::make_unique<Graphic>();
}
bool Graphic::Register(DFTileSurface* (*func)(int,int))

@ -604,7 +604,7 @@ bool DFHack::isStoneInorganic(int material)
std::unique_ptr<Module> DFHack::createMaterials()
{
return dts::make_unique<Materials>();
return std::make_unique<Materials>();
}
Materials::Materials()

@ -436,7 +436,7 @@ DFhackCExport command_result plugin_init(color_ostream& out, std::vector <Plugin
"Automatically manage farm crop selection.",
autofarm));
}
autofarmInstance = std::move(dts::make_unique<AutoFarm>());
autofarmInstance = std::move(std::make_unique<AutoFarm>());
autofarmInstance->load_state(out);
return CR_OK;
}

@ -588,7 +588,7 @@ static int do_cycle(color_ostream &out);
DFhackCExport command_result plugin_init(color_ostream &out, std::vector <PluginCommand> &commands) {
DEBUG(config,out).print("initializing %s\n", plugin_name);
tailor_instance = dts::make_unique<Tailor>();
tailor_instance = std::make_unique<Tailor>();
// provide a configuration interface for the plugin
commands.push_back(PluginCommand(