On Mon, Jan 05, 2004 at 10:16:39AM +0100, Lars Gullik Bjønnes wrote:
> Christian Ridderström <[EMAIL PROTECTED]> writes:
> 
> | On Sun, 4 Jan 2004, Lars Gullik Bjønnes wrote:
> >
> >> >> Where is the obfuscation?
> >
> | I found 
> >
> |     list.remove_if(bind2nd(match(), s));
> >
> | easier to understand on a high level compared to
> >
> |     list.remove_if(bind(equal_to<string>(),
> |                             bind(&Branch::getBranch, _1),
> |                             s));
> >
> | but I've never written C++ code with functors...
> 
> match is a functor...

It 'matches' something. Probably the list element to the string s.
I'd confirm this by looking up the 'match' implementation only if I
really suspect this is wrong. 

The second one might save the (rare) lookup, and would be nicer if it
weren't for this awful syntactically needed cruft. This is like coding
Lisp with a lot of &_!<((> characters interspersed.

Although I like the idea of 'inline functions', I don't like the the
necessary syntax at all. To the degree were the benefit clearly
outweighs the gains.

> So you have no idea _what_ it matches and find still find it nice.

Yes. Because I am used to rely on 'sort' to sort something and on
'print' to print something. 

Actually, you rely on boost::bind to bind something. How is this safer
than having the match() implementation ten lines above the code in
question.

Andre'

Reply via email to