mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
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
|
@ -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…
Add table
Add a link
Reference in a new issue