What does a=&*A mean in C++ (in which A is a pointer)? -
this question has answer here:
i come across instruction
a=&*a; in piece of c++ code, pointer. can explain semantics , in way different a=a?
if a iterator, *a gives value of iterator "pointing" to. & operator applied value address value. unless & operator overloaded.
simple , stupid example:
struct foo { // data... }; std::vector<foo> vector_of_foo; // code populate vector_of_foo (auto = vector_of_foo.begin(); != vector_of_foo.end(); ++a) { foo* = &*a; // requires pointer foo... }
Comments
Post a Comment