A set is a container for holding instances of some class.
When you create it, you state what kind of class that will be.
set<string>
is for holding string objects
set<appSauce>
is for holding appSauce objects
See the format?
set <the_kind_of_object_to_go_in_the_set>
So what kind of object do you want to be stored in the set? One kind of object. Just one. What kind of object do you want to store in the set?
Now that you know this, see how
set<appSauce, string>
makes no sense? If you wanted to store appSauce objects, you'd create a
set<appSauce>
. If you wanted to store string objects, you'd create a
set<string>
.
set<appSauce, string>
just makes no sense, because
appSauce, string
isn't ONE kind of object.
---------
Note that a set will hold only ONE instance of each object. If you try to add something to a set that is the same as something that has already been added, you will NOT get two of them in the set. The set will still only contain ONE of them. So if you're intending to allow your user to pick more than one of some menu item, is a set really the right thing to use to hold their choices?
Here's an example of this:
1 2 3 4
|
set<int> someSet; // create a set for holding int values
someSet.insert(3); // Now, the set contains a single number 3
someSet.insert(4); // Now, the set contains a single number 3 AND a single number 4
someSet.insert(3); // Now, the set contains a single number 3 AND a single number 4 - it does NOT contain two instances of the number 3
|