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
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
Re: Best way to have a static std::string (array?)
Quote:
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?
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.