8

Aha, more c++ knowledge. An implementation of a List (already provided by vector).

Lots of learning here, including use of the placement new operator, which is required for containers like this because if you just use the normal new operator, the buffer will construct a million items.

Also, the buffer is of type char*, not of type T, which really confused me in the beginning.

Lastly, with placement new, you need to call destructors yourself.

Interesting stuff.

Comments
  • 0
    The balance of storing items or pointers to those items or smart pointers to those items is often important too.
Add Comment