2 ms·
The lack of an equivalent of offsetof in C++ is a real pity. This effectively prohibits using C-style data containers, whereby container's control data is embed
by huhtenberg 18y ago
The lack of an equivalent of offsetof in C++ is a real pity. This effectively prohibits using C-style data containers, whereby container's control data is embedded into the data instance itself. This sort of thing:
struct record
{
int foo;
int bar;
...
list_item item; // keeps 'record' on some list
tree_item item; // keeps 'record' on some tree
};
There's no concise and memory-efficient way of doing the same in C++.
- scott_s 18y agoBoost.Intrusive: http://www.boost.org/doc/libs/1_35_0/doc/html/intrusive.html http://www.boost.org/doc/libs/1_35_0/doc/html/intrusive.html