Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix building on C++20 - fix removal of shared_ptr.unique #33

Merged
merged 2 commits into from
Dec 30, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion opennurbs_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14831,7 +14831,9 @@ bool ON_MeshCache::Transform(
ON_Mesh* mesh = item->m_mesh_sp.get();
if (nullptr == mesh || mesh->IsEmpty())
continue;
if (false == item->m_mesh_sp.unique())
// NOTE: use_count() == 1 is an approximation in multi-threaded environments
// https:// en.cppreference.com/w/cpp/memory/shared_ptr/unique
if (false == item->m_mesh_sp.use_count() == 1)
{
// make a copy and transform the copy
std::shared_ptr<ON_Mesh>(new ON_Mesh(*mesh)).swap(item->m_mesh_sp);
Expand Down