MISRAC++2023-4.1.2_l (C++ only)
In this section:
Synopsis
(Advisory) Deprecated features should not be used
Enabled by default
No
Severity/Certainty
Low/Low

Full description
Deprecated feature found [depr.util.smartptr.shared.obs]
Coding standards
This check does not correspond to any coding standard rules.
Code examples
The following code example fails the check and will give a warning:
#include <memory>
int example()
{
auto sp = std::make_shared<int>(5);
return (sp.unique()) ? 0 : 1;
}
The following code example passes the check and will not give a warning about this issue:
#include <memory>
int example()
{
auto sp = std::make_shared<int>(5);
return (sp.use_count() == 1) ? 0 : 1;
}