Trying to make all C++ of the platforms happy.
This commit is contained in:
parent
9fd0c55eb8
commit
211d1ee1e3
3 changed files with 18 additions and 16 deletions
|
@ -75,7 +75,7 @@ if (NOT MSVC)
|
|||
set_target_properties(PrusaSlicer PROPERTIES OUTPUT_NAME "prusa-slicer")
|
||||
endif ()
|
||||
|
||||
target_link_libraries(PrusaSlicer libslic3r)
|
||||
target_link_libraries(PrusaSlicer libslic3r cereal)
|
||||
if (APPLE)
|
||||
# add_compile_options(-stdlib=libc++)
|
||||
# add_definitions(-DBOOST_THREAD_DONT_USE_CHRONO -DBOOST_NO_CXX11_RVALUE_REFERENCES -DBOOST_THREAD_USES_MOVE)
|
||||
|
|
|
@ -69,7 +69,6 @@ protected:
|
|||
void assign_new_unique_ids_recursive() { this->set_new_unique_id(); }
|
||||
|
||||
private:
|
||||
friend class UndoRedo::StackImpl;
|
||||
ObjectID m_id;
|
||||
|
||||
static inline ObjectID generate_new_id() { return ObjectID(++ s_last_id); }
|
||||
|
@ -77,9 +76,9 @@ private:
|
|||
|
||||
friend ObjectID wipe_tower_object_id();
|
||||
friend ObjectID wipe_tower_instance_id();
|
||||
friend class Slic3r::UndoRedo::StackImpl;
|
||||
|
||||
friend class cereal::access;
|
||||
friend class Slic3r::UndoRedo::StackImpl;
|
||||
template<class Archive> void serialize(Archive &ar) { ar(m_id); }
|
||||
ObjectBase(const ObjectID id) : m_id(id) {}
|
||||
template<class Archive> static void load_and_construct(Archive & ar, cereal::construct<ObjectBase> &construct) { ObjectID id; ar(id); construct(id); }
|
||||
|
|
|
@ -153,19 +153,7 @@ public:
|
|||
|
||||
bool is_serialized() const { return m_shared_object.get() == nullptr; }
|
||||
const std::string& serialized_data() const { return m_serialized; }
|
||||
std::shared_ptr<const T>& shared_ptr(StackImpl &stack) {
|
||||
if (m_shared_object.get() == nullptr && ! this->m_serialized.empty()) {
|
||||
// Deserialize the object.
|
||||
std::istringstream iss(m_serialized);
|
||||
{
|
||||
Slic3r::UndoRedo::InputArchive archive(stack, iss);
|
||||
std::unique_ptr<std::remove_const<T>::type> mesh(new std::remove_const<T>::type());
|
||||
archive(*mesh.get());
|
||||
m_shared_object = std::move(mesh);
|
||||
}
|
||||
}
|
||||
return m_shared_object;
|
||||
}
|
||||
std::shared_ptr<const T>& shared_ptr(StackImpl &stack);
|
||||
|
||||
#ifdef SLIC3R_UNDOREDO_DEBUG
|
||||
std::string format() override {
|
||||
|
@ -560,6 +548,21 @@ namespace cereal
|
|||
namespace Slic3r {
|
||||
namespace UndoRedo {
|
||||
|
||||
template<typename T> std::shared_ptr<const T>& ImmutableObjectHistory<T>::shared_ptr(StackImpl &stack)
|
||||
{
|
||||
if (m_shared_object.get() == nullptr && ! this->m_serialized.empty()) {
|
||||
// Deserialize the object.
|
||||
std::istringstream iss(m_serialized);
|
||||
{
|
||||
Slic3r::UndoRedo::InputArchive archive(stack, iss);
|
||||
std::unique_ptr<std::remove_const<T>::type> mesh(new std::remove_const<T>::type());
|
||||
archive(*mesh.get());
|
||||
m_shared_object = std::move(mesh);
|
||||
}
|
||||
}
|
||||
return m_shared_object;
|
||||
}
|
||||
|
||||
template<typename T, typename T_AS> ObjectID StackImpl::save_mutable_object(const T &object)
|
||||
{
|
||||
// First find or allocate a history stack for the ObjectID of this object instance.
|
||||
|
|
Loading…
Reference in a new issue