[string algorithms] feature request - case-insensitive less

I was looking at the string algorithms library, and I saw it had a case-insensitive equals function, iequals, as well as a predicate class, is_iequal. It would be nice if there were a case-insensitive less-than function and predicate as well. This would facilitate case-insensitive sorting, and set or maps which are sorted case-insensitively. Joe Gottman

Hi Joe, On Sat, May 07, 2005 at 08:18:42PM -0400, Joe Gottman wrote:
I was looking at the string algorithms library, and I saw it had a case-insensitive equals function, iequals, as well as a predicate class, is_iequal. It would be nice if there were a case-insensitive less-than function and predicate as well. This would facilitate case-insensitive sorting, and set or maps which are sorted case-insensitively.
Joe Gottman
I'm not sure if there is not a little bit of confusion here. is_iequal provides character-base comparison that can be used in algorithms like equals. Not vise-versa. So if I understand it correctly you would need class the will encapsulate equals/iequals algorithm. The same goes for less-then function you have proposed. Actualy, you can make comparison using std::lexicographical_compare function, just you will have to provide predicate class for maps and sets. It might be reasonable to include range-base variant of lexicographical_compare functions for convenience. But I think, that predicate classes should be placed elsewhere, maybe closer to map/set implementation. However, I might reconsider it laters. Regards, Pavol

But I think, that predicate classes should be placed elsewhere, maybe closer to map/set implementation.
What about predicate classes for equals, starts_with etc so you can use them with standard algorithms without specifying all template arguments. Something like: struct istarts_with_pred { template<typename T1, typename T2> bool operator()(const T1& arg1, const T2& arg2) const { return boost::istarts_with(arg1, arg2); } }; std::find_if(vectorofstrings.begin(), vectorofstrings.end(), bind<bool> (istarts_with_pred(), _1, "prefix")) Also, will 1.32 be the last version where string_algo works with VC70?

On Mon, May 09, 2005 at 09:03:04AM +0000, Martin wrote:
But I think, that predicate classes should be placed elsewhere, maybe closer to map/set implementation.
What about predicate classes for equals, starts_with etc so you can use them with standard algorithms without specifying all template arguments.
Something like:
struct istarts_with_pred { template<typename T1, typename T2> bool operator()(const T1& arg1, const T2& arg2) const { return boost::istarts_with(arg1, arg2); } };
std::find_if(vectorofstrings.begin(), vectorofstrings.end(), bind<bool> (istarts_with_pred(), _1, "prefix"))
I'm aware, that this is precisely what needs to be done. However I'm not yet 100% convinced if if should go to string_algo lib. Yet, I'm starting to think in favor of it.
Also, will 1.32 be the last version where string_algo works with VC70?
Vc70 support was temporary dropped because I have switched from internal "Range" version to the official one. But there is already a work in progress to make Boost.Range working with vc70. So vc70 will be supported in the upcomming release. Regards, Pavol

Pavol Droba wrote:
Vc70 support was temporary dropped because I have switched from internal "Range" version to the official one. But there is already a work in progress to make Boost.Range working with vc70. So vc70 will be supported in the upcomming release.
Given bcc32 works (partly) with boost.range, will string algo have some support for bcc32 in the next release? Thanks Russell

On Mon, May 09, 2005 at 01:11:03PM +0100, Russell Hind wrote:
Pavol Droba wrote:
Vc70 support was temporary dropped because I have switched from internal "Range" version to the official one. But there is already a work in progress to make Boost.Range working with vc70. So vc70 will be supported in the upcomming release.
Given bcc32 works (partly) with boost.range, will string algo have some support for bcc32 in the next release?
I have no access to bcc32 compiler. But if somebody want to invest some effort here I'm more then willing to help. Regards, Pavol

Pavol Droba wrote:
I have no access to bcc32 compiler. But if somebody want to invest some effort here I'm more then willing to help.
Ok, when I get some time, I'll download CVS head and see what happens. Cheers Russell
participants (4)
-
Joe Gottman
-
Martin
-
Pavol Droba
-
Russell Hind