|
Boost Users : |
From: Matthias Kaeppler (nospam_at_[hidden])
Date: 2005-07-16 08:02:11
Hi,
I am aware that string_algo has an if_iequal functor. Is there also an
equivalent for a less-than comparison? I have to compare strings
ignoring the case but taking locales into account.
Right now I'm calling boost::algorithm::to_lower on two copies of the
original strings. I'm not so sure if this is very efficient when I'm
comparing thousands of strings.
Here's the functor as it is now:
struct FileLessNameA
: std::binary_function<const File&,const File&,bool> {
bool operator() (const File& lhs, const File& rhs) const {
std::string path1( lhs.get_name().c_str() );
std::string path2( rhs.get_name().c_str() );
boost::algorithm::to_lower( path1 );
boost::algorithm::to_lower( path2 );
return path1 < path2;
}
};
Any suggestions for improvements appreciated :)
Regards,
Matthias
-- Matthias Kaeppler
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net