Implementing normal algorithms using predicate versions

Gabriel Dos Reis gdr@integrable-solutions.net
Mon Nov 29 00:00:00 GMT 2004


Paolo Carlini <pcarlini@suse.de> writes:

| chris wrote:
| 
| > I was intending on using something like (warning: away from C++
| > compiler, I haven't even compiled this code!)
| >
| > template<typename __T1, typename __T2>
| > struct __default_predicate {
| > bool
| > operator()(const __T1& __t1, const __T2& __t2) { return __t1<__t2;}
| > };
| 
| Ah, yes, this - or slight variations - look good. Maybe we should
| discuss a bit
| more the optimization thing and then, possibly, actually implement the idea
| in v7... :)

I see it more as a good code organization than optimization :-)
But, yes I'm for anything sensible along that line that reduces code
duplication.  I already discussed the idea with Benjamin (back in
October 2002) and he was quite positive about it.  It did not happen
because I did not submit the full patch, but if you can over that that
is great! :-)

-- Gaby



More information about the Libstdc++ mailing list