АР
Size: a a a
АР
AF
Y
АР
ZS
((int)strlen(str) > max)
AF
0 > max || strlen(str) > max
m
AF
AM
m
AF
AF
K
template <typename T, typename F>
bool foo (const T & x, const F & a, const F & b)
{
return a (x) == b (x);
}
template <typename T>
bool bar (const T & x, const T & a, const T & b)
{
return foo (
x,
[&] (const T & arg) {return a == arg;},
[&] (const T & arg) {return b == arg;});
}
int main ()
{
bar (0, 0, 0);
}
no matching function for call to ‘foo(const int&, bar(const T&, const T&, const T&) [with T = int]::<lambda(const int&)>, bar(const T&, const T&, const T&) [with T = int]::<lambda(const int&)>)’
deduced conflicting types for parameter ‘const F’ (‘bar(const T&, const T&, const T&) [with T = int]::<lambda(const int&)>’ and ‘bar(const T&, const T&, const T&) [with T = int]::<lambda(const int&)>’)
foo
, например вот так template <typename T, typename F1, typename F2>
SS
IL
SS
std::function
std::function<bool(int)> f_a = [&] (const T & arg) {return a == arg;};
std::function<bool(int)> f_b = [&] (const T & arg) {return b == arg;};
return foo (x, f_a, f_b);