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

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -