Skip to content

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

Merged
sbaer merged 2 commits into
mcneel:7.xfrom
aminya:cpp-20-shared_ptr-unique
Dec 30, 2021
Merged

fix: fix building on C++20 - fix removal of shared_ptr.unique#33
sbaer merged 2 commits into
mcneel:7.xfrom
aminya:cpp-20-shared_ptr-unique

Conversation

@aminya

@aminya aminya commented Dec 3, 2021

Copy link
Copy Markdown
Contributor

This replaces the removed shared_ptr.unique with .use_count() == 1
See this for the explanation
https:// en.cppreference.com/w/cpp/memory/shared_ptr/unique

Cherry-picked from #28

C:/opennurbs/opennurbs_mesh.cpp:14834:34: error: no member named 'unique' in 'std::shared_ptr<ON_Mesh>'
    if (false == item->m_mesh_sp.unique())
                 ~~~~~~~~~~~~~~~ ^

This replaces the removed shared_ptr.unique with .use_count() == 1
See this for the explanation
https:// en.cppreference.com/w/cpp/memory/shared_ptr/unique

@sbaer sbaer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really hard to read. I would recommend changing this to
if (item->m_mesh_sp.use_count() != 1)

@aminya

aminya commented Dec 29, 2021

Copy link
Copy Markdown
Contributor Author

This is really hard to read. I would recommend changing this to if (item->m_mesh_sp.use_count() != 1)

Fixed in 71e81b4

@sbaer
sbaer merged commit 19e5595 into mcneel:7.x Dec 30, 2021
danielgronlund pushed a commit to danielgronlund/opennurbs that referenced this pull request Apr 3, 2024
fix: fix building on C++20 - fix removal of shared_ptr.unique

Thanks for the fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants