In a set, the value is the key. In a map, the key and value are distinct.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>So is a set like any other list/vector except that it's sorted?
Sure, you can think of it like that for the time being. :)
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>By the way, is there some sort of parent class that all STL containers descend from?
No. In fact, all of the standard containers are concrete classes and can't be safely used as base classes because they lack a virtual destructor.
>Does this make sense?
Sorted and not sorted are only minor details. For example, a set doesn't support random access iterators while a vector does. So your container's public interface would change drastically because non-sorted is a sequence container and sorted is an associative container. If you want a sorted vector then the standard sort algorithm can be used periodically, or you can create your own sorted sequence class that contains a vector and supports the operations that you need for it.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401