Re: any_of, all_of, none_of
Am 27.08.2011 14:55, schrieb gast128@hotmail.com:
{ quoted c.l.c++.m server banner removed. -mod }
On 27 aug, 04:18, Daniel Kr?gler<daniel.krueg...@googlemail.com>
wrote:
On 2011-08-26 00:52, gast...@hotmail.com wrote:
<snip>
[&](int i) { return i == 3; }
We already have some sort of
templated STL extensions library with all / all_if and I was thinking
just to replace the implementation with STL variants.
Can you please provide a concrete example? I'm not sure that I can agree
with that as written.
Greetings from Bremen,
- Daniel Kr?gler
How about (almost a literal copy of Boost's STLAlgorithmExtensions /
AllAlgorithm):
template<typename For, typename ValueType>
bool all(For first, For last, const ValueType& rValue)
{
//Note: empty range [first, last> returns true
for (; first != last; ++first)
{
if (*first != rValue)
{
return false;
}
}
return true;
}
I should have made it clearer that my question was referring to the
first part of your assertion:
"That would be an option, except that this will not work when it is a
template (if I recollect correctly)."
I certainly understand that as of the current specification a lambda
closure can not be a template, but how does this restriction compare
with your original example, where you seem to ask for a default version?
Greetings from Bremen,
- Daniel Kr?gler
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]