In this case, the double pointer idiom is an inheritance of C. C did not have a notion of references (and still does not exist), so the only way to change the pointer is to pass the pointer to the pointer.
But since C ++ offers links, you should use them when you only need to change a variable in a function, whether it be a pointer or not, as this allows the code to be more understandable about the programmer's intentions.
The exception must be higher than the rule if you want to use null as a special case (a link can never point to null)
source share