Make netlist compile with c++11, use own implementation of make_unique

to avoid c++14. (nw)
This commit is contained in:
couriersud 2016-05-25 14:52:40 +02:00
parent cac1c41edf
commit f5179f7ec8
4 changed files with 11 additions and 4 deletions

View File

@ -42,7 +42,7 @@ NETLIB_OBJECT(log)
enregister("I", m_I);
pstring filename = pfmt("{1}.log")(this->name());
m_strm = std::make_unique<pofilestream>(filename);
m_strm = pmake_unique<pofilestream>(filename);
}
NETLIB_DESTRUCTOR(log);
NETLIB_UPDATEI();

View File

@ -10,6 +10,8 @@
#include <exception>
#include <vector>
#include <memory>
#include <utility>
#include "pconfig.h"
#include "pstring.h"
@ -121,6 +123,11 @@ inline void pfree_array_t(T *p)
#endif
template<typename T, typename... Args>
std::unique_ptr<T> pmake_unique(Args&&... args) {
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
class pmempool
{
private:

View File

@ -36,7 +36,7 @@ ATTR_COLD void pstate_manager_t::save_state_ptr(const pstring &stname, const pst
"DT_FLOAT"
};
auto p = std::make_unique<pstate_entry_t>(stname, dt, owner, size, count, ptr, is_ptr);
auto p = pmake_unique<pstate_entry_t>(stname, dt, owner, size, count, ptr, is_ptr);
m_save.push_back(std::move(p));
}
@ -70,7 +70,7 @@ template<> ATTR_COLD void pstate_manager_t::save_item(pstate_callback_t &state,
{
//save_state_ptr(stname, DT_CUSTOM, 0, 1, &state);
pstate_callback_t *state_p = &state;
auto p = std::make_unique<pstate_entry_t>(stname, owner, state_p);
auto p = pmake_unique<pstate_entry_t>(stname, owner, state_p);
m_save.push_back(std::move(p));
state.register_state(*this, stname);
}

View File

@ -38,7 +38,7 @@ static pvector_t<int> bubble(const pvector_t<Class> &sl)
void nl_convert_base_t::add_pin_alias(const pstring &devname, const pstring &name, const pstring &alias)
{
pstring pname = devname + "." + name;
m_pins.add(pname, std::make_unique<pin_alias_t>(pname, devname + "." + alias));
m_pins.add(pname, pmake_unique<pin_alias_t>(pname, devname + "." + alias));
}
void nl_convert_base_t::add_ext_alias(const pstring &alias)