|
Boost : |
From: Brock Peabody (brock.peabody_at_[hidden])
Date: 2006-04-12 16:42:54
> On Behalf Of Peter Dimov
> What I really want is this:
What I really want to be able to do is everything I can do in Haskell,
but in C++ :) I'm very grateful for Boost.Lambda but language support
is needed to make it fully functional (pun not intended).
>
> void foo( myvec& v, const myset& s, int a )
> {
> // ...
>
> inline bool f( int x ) { return std::abs( x ) < a && s.find( x )
!=
> s.end(); }
>
> v.erase( std::remove_if( v.begin(), v.end(), f ), v.end() );
> }
I like local functions, but one problem I see with this is that it can't
work in a template. If you make f a template it will be ambiguous
without a cast or something. If only we could pass functions by name.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk