c++ - Automatically Pass Parent Pointer to its Variables? -
this functionality have, wondering if there way able pass parent pointer it's variables without having = this?
struct location; struct parent { std::vector<location*> locations; }; struct location { location(parent* p) { p->locations.push_back(this); } }; struct specialparent : parent { location = this; location b = this; location c = this; location zabazoo = this; // etc }; the point of can still specialparent->zabazoo still batch process locations operations.
location = b = c = zabazoo = this; the quick brown fox jumps on lazy dog.
Comments
Post a Comment