Quantcast
Channel: Pointer ownership with atomic variables - Stack Overflow
Browsing latest articles
Browse All 3 View Live

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 Article



Answer 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 Article

Pointer 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
Browsing latest articles
Browse All 3 View Live




Latest Images