|
-
Insight on STL Containers & One Specific Question
Hi,
What is your perference when it comes to STL containers? I know many programmers prefer the vector because it random-access. However, deque container is random-access and could be changed from front, middle and back. I prefer the list, but it is hard for me to access specific data inside the list mainly because of my inexperience with STL. Nonetheless, I prefer list because of the innovative way it manages insert and delete (does not need to move all data).
I am implementing deque a program. The program reads data from a file line by line. The program saves each line of data from the file into a character array. I want to "push" each character array into a deque. At the end, I use the unique function to delete all clones. For example let say I have a file with the following:
-------
123
231
123
321
-------
First, the program reads one line at a time and copy the line into a character array. Then the program copies the entire character array into the STL container. Once the program has reached the end of the file, then it will delete all clones such as "123" from the above example.
How do you push a *character array* into an STL container, specifically a deque?
Thanks,
Kuphryn
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|