[string_algo] is_less and is_iless

Hi, I asked about the missing less-than equivalent to the is_equal and is_iequal predicates in the boost string_algo library some time ago. I was told that they are subject to enter the boost library soon (it's actually not much more than a copy'n'paste job from is_equal). But now since 1.33 is live and it's still not in the library, I thought I'd ask again. I have already written is_iless, if that is of any help: struct is_iless { is_iless(const std::locale& loc = std::locale()): loc_(loc) {} template<typename T1, typename T2> bool operator () (const T1& arg1, const T2& arg2) const { return std::toupper(arg1, loc_) < std::toupper(arg2 , loc_); } private: std::locale loc_; }; Any chance it will make it into the library with the next release? Best regards, Matthias

Hi, Sorry for keeping you waiting. I have not forgotten about it and I would very much like to put it to the next release. I just haven't find a time to look into But I have it in my schedule before xmas. Best Regards, Pavol On Mon, Nov 28, 2005 at 04:17:56PM +0100, Matthias Kaeppler wrote:
Hi,
I asked about the missing less-than equivalent to the is_equal and is_iequal predicates in the boost string_algo library some time ago.
I was told that they are subject to enter the boost library soon (it's actually not much more than a copy'n'paste job from is_equal). But now since 1.33 is live and it's still not in the library, I thought I'd ask again.
I have already written is_iless, if that is of any help:
struct is_iless { is_iless(const std::locale& loc = std::locale()): loc_(loc) {}
template<typename T1, typename T2> bool operator () (const T1& arg1, const T2& arg2) const { return std::toupper(arg1, loc_) < std::toupper(arg2 , loc_); }
private: std::locale loc_; };
Any chance it will make it into the library with the next release?
Best regards, Matthias
Sorry for keeping you waiting. I have not forgotten about it and I would very much like to put it to the next release. I just haven't find a time to look into it. But I have it in my schedule before xmas. Best Regards, Pavol

Pavol Droba wrote:
Sorry for keeping you waiting. I have not forgotten about it and I would very much like to put it to the next release.
I just haven't find a time to look into But I have it in my schedule before xmas.
Thanks a lot, very much appreciated. Best regards, Matthias Kaeppler

Sorry for keeping you waiting. I have not forgotten about it and I would very much like to put it to the next release.
I just haven't find a time to look into But I have it in my schedule before xmas.
Any chance we'll see _real_ predicates as well (i.e. starts_with etc that can be used with standard algorithms)? std::find_if(v.begin(), v.end(), istarts_with("abcd"));

On Mon, Nov 28, 2005 at 09:00:53PM +0000, Martin wrote:
Sorry for keeping you waiting. I have not forgotten about it and I would very much like to put it to the next release.
I just haven't find a time to look into But I have it in my schedule before xmas.
Any chance we'll see _real_ predicates as well (i.e. starts_with etc that can be used with standard algorithms)?
std::find_if(v.begin(), v.end(), istarts_with("abcd"));
What you have shown is just a simple example of currying and there are at least two facilities in Boost that provide such a functionality. Namely Boost.Bind and Boost.Lambda. You can write something like this: std::find_if( vec.begin(), vec.end(), boost::bind<bool>(boost::istarts_with<std::string, std::string>, _1, "bc", std::locale())); It is not as nice as your example, but it works. I'm little bit reluctant to add something like this directly to the library. There are already quite a lot of variants of algorithms. Adding some more could be quite confusing. I would prefere to add some realy new functionality. But don't take this as a final 'no' from me. I'm open for discussion. Best regards, Pavol

Pavol Droba wrote:
What you have shown is just a simple example of currying and there are at least two facilities in Boost that provide such a functionality. Namely Boost.Bind and Boost.Lambda.
You can write something like this:
std::find_if( vec.begin(), vec.end(), boost::bind<bool>(boost::istarts_with<std::string, std::string>, _1, "bc", std::locale()));
It is not as nice as your example, but it works.
I'm little bit reluctant to add something like this directly to the library. There are already quite a lot of variants of algorithms. Adding some more could be quite confusing. I would prefere to add some realy new functionality.
Isn't this a good example of why we actually need the functionality in the library? I can't imagine very many people that would get the above right in the first 5-10 tries. -Thorsten
participants (4)
-
Martin
-
Matthias Kaeppler
-
Pavol Droba
-
Thorsten Ottosen