M***@DastartdlyHQ.org
2024-10-07 07:32:02 UTC
Isn't it about time that lambda functions could be used directly as STL
comparitors instead of it being an ugly 2 step process?
ie instead of:
auto comp = [](const string &s1, const string &s2)
{
return strcasecmp(s1.c_str(),s2.c_str()) < 0;
};
map<string,int,decltype(comp)> m(comp);
which is no simpler than just using a functor, why can't we just do:
map<string,int,[](const string &s1, const string &s2)
{
return strcasecmp(s1.c_str(),s2.c_str()) < 0;
}) m;
I'm sure updating the compilers so a lambda could be a template parameter
wouldn't be beyond the wit of man.
Rather than adding esoteric functionality no one uses wouldn't it be better
to tidy up what there is already?
comparitors instead of it being an ugly 2 step process?
ie instead of:
auto comp = [](const string &s1, const string &s2)
{
return strcasecmp(s1.c_str(),s2.c_str()) < 0;
};
map<string,int,decltype(comp)> m(comp);
which is no simpler than just using a functor, why can't we just do:
map<string,int,[](const string &s1, const string &s2)
{
return strcasecmp(s1.c_str(),s2.c_str()) < 0;
}) m;
I'm sure updating the compilers so a lambda could be a template parameter
wouldn't be beyond the wit of man.
Rather than adding esoteric functionality no one uses wouldn't it be better
to tidy up what there is already?