I want to have a list. An entry in the list would store a value as well as an iterator to another entry in the list. How do I define this type? It\'d be something like this,
You can achieve that by forward declaring your element.
#include struct Element; typedef std::list ElementList; struct Element { int value; ElementList::iterator element; }; int main() { ElementList l; l.push_back({0, l.end()}); l.push_back({1, l.begin()}); }