No Atomic Version of std::shared_ptr
Question: Does a non-atomic equivalent of std::shared_ptr exist outside the standard library? Why was a non-atomic version not included in C 11?
Answer:
1. Non-Atomic Equivalent
std::shared_ptr, unlike other smart pointers in the standard library, is atomic. While there may be third-party alternatives, the standard itself does not provide a non-atomic version.
2. Exclusion from C 11
The inclusion of a non-atomic std::shared_ptr was debated at the C 11 Rapperswil meeting. Arguments against its inclusion included:
After consideration, the LWG ultimately rejected the proposal for a non-atomic std::shared_ptr, reasoning that it lacked clear consensus and the benefits did not outweigh the drawbacks.
The above is the detailed content of Does C Provide a Non-Atomic Equivalent of `std::shared_ptr`?. For more information, please follow other related articles on the PHP Chinese website!