Set and memory

does using a set to store integers take more space than using an array to do so?
Yes. As far as I know std::set is usually implemented as a red-black tree.
Trees are made of nodes, which are linked together. So each node contains the extra linking information, besides the actual integer.

Arrays are pretty much a contiguous block of memory containing the bare data.

http://en.wikipedia.org/wiki/Red%E2%80%93black_tree
Topic archived. No new replies allowed.