Evaluation of (de)reference operators

Posted by Micha on Stack Overflow See other posts from Stack Overflow or by Micha
Published on 2012-12-18T22:49:17Z Indexed on 2012/12/18 23:03 UTC
Read the original article Hit count: 161

Filed under:
|
|
|

I have an (uncommented...) source file which I'm trying to understand.

static const Map *gCurMap;
static std::vector<Map> mapVec;

then

auto e = mapVec.end();
auto i = mapVec.begin();
while(i!=e) {
    // ...
    const Map *map = gCurMap = &(*(i++));
    // ...
}

I don't understand what &(*(i++)) does. It does not compile when just using i++, but to me it looks the same, because I'm "incrementing" i, then I'm requesting the value at the given address and then I'm requesting the address of this value?!

© Stack Overflow or respective owner

Related posts about c++

Related posts about pointers