
Hi, Joe Gottman wrote:
I just discovered that the string algorithm predicate is_any_of has an inefficient implementation. Internally it uses a std::set. There are two problems with this. First, since the order of the characters does not matter, std::unordered_set is probably faster.
TR1 was not available at the time this class was implemented. So couldn't have used it. Thanks for suggestion.
Second, the contained set has to be copied each time the object is used in, for instance, a split() statement. Since split can reuse a predicate literally thousands of times when splitting a large string, this is a lot of unnecessary copying.
I'm aware of this. I'm working on am optimization for passing functors around the string_algo algorithms, but I'm not finished with it yet. Once finished, the copying will be mostly eliminated. Regards, Pavol.