-
one of the STL libraries
I don't know which one it is. I've never used the STL before, and I'm just getting started, and finding that using it doesn't appear to be horribly difficult. I just need clarification on one thing... which one of the libraries is like a linked list, but only adds a new element if it doesn't exist anywhere else in the list? Like, if I tried to added "1,2,3,4,5,6" to the list, and then tried to add 5 again, it wouldn't do anything. Hmmm... I think there is one. Am I wrong?
-
-
haha, I decided that instead of reading, I would program my own for this... it didn't take as long as I thought it would... lol. I'm a loser.
-
There's only one STL. What you're looking for is an STL container.
-
std::list also has a function, unique() which removes adjacent identical elements.
-
Also note, <algorithm> defines a generic std::unique algorithm which does the same.
-
Just remember the key thing with the unique function is that the elements in the container are required to be sorted prior to its use.