Weak / strong link

I am trying to write my own weak / strong pointer, but I do not quite understand the relationship. Everything that I seem to meet does not do this and is not clear, and quite often one document will overlook what another document says. Can someone explain the link with the weak / strong pointer in detail, perhaps an image or code sample?

(Please donโ€™t just tell me โ€œuse boostโ€ or โ€œuse tr1โ€ etc. This is not homework, I want to find out).

+3
source share
1 answer

A strong pointer owns a basic raw pointer. Its existence may contain a living pointer, and as a result, it cannot indicate what has been cleared. Destroying it may result in deletion by an unprocessed pointer. A weak pointer knows only the raw pointer and whether it remains valid. It does not keep the active pointer existing, and it cannot force the cleared pointer to go away by clearing.

To get a more detailed answer, you will need to show the contradictions found or the question that you have about a particular part of the definition.

+8
source

All Articles