You can write your own function object to compare the string lengths, though you still have to pass in elements of the container.

Originally Posted by Bjarne Stroustrup (2000-10-14)

I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.

> What if I didn't want to pass in the element of a container...what if I wanted to pass in the string length of each element?!

I don't think this should be a problem. For example, if you were using find_if on a container of strings, and you wanted to find an element with length equal to 7, you can fairly easily write your own functor, e.g.: