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

You are on the right track here, but consider what the contained object is:

    std::list <person*> people;
You're right that the instantiated list entry (what the article calls "helper") will directly include a value, but the value here is a pointer to a person, not a person.


There is nothing stopping him from having a list of person and avoiding the memory overhead of references though.


I had overlooked that he was using a pointer to the struct, and so I was interpreting things to be that C++ was actually doing under the hood allocations. I'm glad I asked though, cause I was really worried about C++ for a second there :)

So it seems like if the author had wanted he could have used C++ like a safer version of C macros, which if I ever need to use C++ will likely be my approach too.




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

Search: