H. S. Teoh:

you *can* allocate by-value
types on the heap, e.g., `MyStruct* ptr = new MyStruct(...)`. But it's rare to want to do that; usually if you need to do
that, you should just use a class instead.

If I create data structures that contain many pointers, like some kinds of trees, I usually use heap-allocated structs, to reduce memory overhead and simplify the whole structure.

Bye,
bearophile

Reply via email to