1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| template <class T,class type> type* Filter(type *s,type *t,type *ss,T func){ for(;s<t;s++) if(func(*s)) *ss = *s,ss++; return ss; }
auto Filter = [](auto *s,auto *t,auto *ss,auto func){ for(;s<t;s++) if(func(*s)) *ss = *s,ss++; return ss; };
template<class T,class type> auto Filter(type*s,type*t,type*ss,T func){ return [](type*s,type*t,type*ss,T func){ for(;s<t;s++) if(func(*s)) *ss = *s,ss++; return ss; }(s,t,ss,func); }
template<class T,class type> auto Filter(type*s,type*t,type*ss,T func){ return [&](){ for(;s<t;s++) if(func(*s)) *ss = *s,ss++; return ss; }(); }
auto Filter = [](auto *s,decltype(s) t,decltype(s) ss,auto func){ for(;s<t;s++) if(func(*s)) *ss = *s,ss++; return ss; };
|