-
April 28th, 2011, 12:19 PM
#1
Best way to have a static std::string (array?)
Hello,
I've got a class, which reads data from a external program. It has to compare these values each time with a array of std::strings. What would be the best way to declare and compare this?
a Vector for std::string or a list. Some Boost:: library option?
Small exmaple,
Program recieves value 1990->in string -> compare with a static std::string
The static std::string array will be filled with user input from the GUI.
Thanks a lot.
NM
-
April 28th, 2011, 12:20 PM
#2
Re: Best way to have a static std::string (array?)
Compare for what reason? Just to see if the string is in the list? If so, I'd store them all in a set.
Viggy
-
April 28th, 2011, 12:30 PM
#3
Re: Best way to have a static std::string (array?)
Originally Posted by MrViggy
Compare for what reason? Just to see if the string is in the list? If so, I'd store them all in a set.
Viggy
Yes the value I recieve to compare with the strings in the array/list/vecotr. Why a set?
-
April 28th, 2011, 12:46 PM
#4
Re: Best way to have a static std::string (array?)
A set is going to be more efficient to search than a list or vector. This might not make much difference if you only have a few things to test against though.
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
|
Click Here to Expand Forum to Full Width
|