AutosarC++18_10-A20.8.6¶
std::make_shared shall be used to construct objects owned by std::shared_ptr
Required inputs: IR
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
shared_ctor_used |
Call to constructor of std::shared_ptr rather than using std::make_shared. |
None |
False |
unique_ctor_used |
Call to constructor of std::unique_ptr rather than using std::make_unique. |
None |
False |
Options¶
This rule shares the following common options: exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
consider_std_unique¶
consider_std_unique : bool = False
std::unique_ptr should be
reported.
only_suggest_semantically_identical_replacements¶
only_suggest_semantically_identical_replacements : bool = True
make_shared or
make_unique if the replacement would be semantically equivalent.
For instance, std::shared_ptr{new B} is equivalent to
std::make_shared(), but std::shared_ptr{b} is not
equivalent to either std::make_shared() or
std::make_shared(b).