Conversation
Replaces deprecated unique() (https://en.cppreference.com/w/cpp/memory/shared_ptr/unique) with use_count() == 1 (https://en.cppreference.com/w/cpp/memory/shared_ptr/use_count.html). Avoids deprecation warnings on modern compilers.
|
clang-tidy review says "All clean, LGTM! 👍" |
|
I'm not opposed to this change as a temporary solution, but as mentioned in #2894, perhaps we should take a moment to check why we need this in the first place. |
The main purpose of this change would be to silence the deprecation warnings on recent compilers and avoid compilation failures on even newer ones. As far as I can tell .use_count()==1 and .unique() are identical, apart from the deprecation (warning). This also means that it does not alleviate potential issues with unique() in multi-threaded environments. |
Yes, I understand, but I think the compiler warnings and the deprecation of |
|
That is exactly what I meant. |
Replaces deprecated unique() (https://en.cppreference.com/w/cpp/memory/shared_ptr/unique) with use_count() == 1 (https://en.cppreference.com/w/cpp/memory/shared_ptr/use_count.html). Avoids deprecation warnings on modern compilers.