Answer by Jonathan Wakely for Pointer ownership with atomic variables
No. std::atomic<T*> has a trivial destructor that does nothing, so it could not delete anything if it owned it.std::atomic<int> doesn't "own" the integer, it just stores a value, and...
View ArticleAnswer by Caesar for Pointer ownership with atomic variables
No, the only thing std::atomic guarantees is that the object will be free from data races. So you will have free the memory that the pointer points to your self.If you want a managed dynamic memory...
View ArticlePointer ownership with atomic variables
Does an atomic variable, 'containing' a pointer, take ownership of the pointer?Consider the following snippet:{ std::atomic<Foo*> bar(new Foo());}// `bar' went out of scope, did it delete pointer...
View Article
More Pages to Explore .....