Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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++.





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: