diff --git a/src/frontend/terminaloverlay.cc b/src/frontend/terminaloverlay.cc index cb2456d..5ce4e07 100644 --- a/src/frontend/terminaloverlay.cc +++ b/src/frontend/terminaloverlay.cc @@ -16,6 +16,8 @@ along with this program. If not, see . */ +#include +#include #include #include #include @@ -24,6 +26,7 @@ #include "terminaloverlay.h" +using namespace boost::lambda; using namespace Overlay; using std::max; @@ -98,8 +101,8 @@ Validity ConditionalOverlayCell::get_validity( const Framebuffer &fb, int row, if ( (current.contents == replacement.contents) || (current.is_blank() && replacement.is_blank()) ) { auto it = find_if( original_contents.begin(), original_contents.end(), - [&]( const Cell &x ) { return ( (replacement.is_blank() && x.is_blank()) - || (replacement.contents == x.contents) ); } ); + (replacement.is_blank() && bind( &Cell::is_blank, _1 )) + || replacement.contents == (&_1)->*&Cell::contents ); if ( it == original_contents.end() ) { return Correct; } else { @@ -311,7 +314,7 @@ void TitleEngine::set_prefix( const wstring s ) void ConditionalOverlayRow::apply( Framebuffer &fb, uint64_t confirmed_epoch, bool flag ) const { - for_each( overlay_cells.begin(), overlay_cells.end(), [&]( const ConditionalOverlayCell &x ) { x.apply( fb, confirmed_epoch, row_num, flag ); } ); + for_each( overlay_cells.begin(), overlay_cells.end(), bind( &ConditionalOverlayCell::apply, _1, var(fb), confirmed_epoch, row_num, flag ) ); } void PredictionEngine::apply( Framebuffer &fb ) const @@ -321,15 +324,15 @@ void PredictionEngine::apply( Framebuffer &fb ) const || (display_preference == Always) ); if ( show ) { - for_each( cursors.begin(), cursors.end(), [&]( const ConditionalCursorMove &x ) { x.apply( fb, confirmed_epoch ); } ); + for_each( cursors.begin(), cursors.end(), bind( &ConditionalCursorMove::apply, _1, var(fb), confirmed_epoch ) ); - for_each( overlays.begin(), overlays.end(), [&]( const ConditionalOverlayRow &x ){ x.apply( fb, confirmed_epoch, flagging ); } ); + for_each( overlays.begin(), overlays.end(), bind( &ConditionalOverlayRow::apply, _1, var(fb), confirmed_epoch, flagging ) ); } } void PredictionEngine::kill_epoch( uint64_t epoch, const Framebuffer &fb ) { - cursors.remove_if( [&]( ConditionalCursorMove &x ) { return x.tentative( epoch - 1 ); } ); + cursors.remove_if( bind( &ConditionalCursorMove::tentative, _1, epoch - 1 ) ); cursors.push_back( ConditionalCursorMove( local_frame_sent + 1, fb.ds.get_cursor_row(), @@ -526,16 +529,15 @@ void PredictionEngine::cull( const Framebuffer &fb ) } } - cursors.remove_if( [&]( const ConditionalCursorMove &x ) { - return (x.get_validity( fb, - local_frame_sent, local_frame_acked, local_frame_late_acked, - now ) != Pending); } ); + cursors.remove_if( bind( &ConditionalCursorMove::get_validity, _1, var(fb), + local_frame_sent, local_frame_acked, local_frame_late_acked, + now ) != Pending ); } ConditionalOverlayRow & PredictionEngine::get_or_make_row( int row_num, int num_cols ) { auto it = find_if( overlays.begin(), overlays.end(), - [&]( const ConditionalOverlayRow &x ) { return x.row_num == row_num; } ); + (&_1)->*&ConditionalOverlayRow::row_num == row_num ); if ( it != overlays.end() ) { return *it; diff --git a/src/network/transportsender.cc b/src/network/transportsender.cc index 621f90f..a9309f9 100644 --- a/src/network/transportsender.cc +++ b/src/network/transportsender.cc @@ -16,6 +16,7 @@ along with this program. If not, see . */ +#include #include #include #include @@ -23,6 +24,7 @@ #include "transportsender.h" #include "transportfragment.h" +using namespace boost::lambda; using namespace Network; using namespace std; @@ -280,8 +282,8 @@ void TransportSender::process_acknowledgment_through( uint64_t ack_num /* Ignore ack if we have culled the state it's acknowledging */ if ( sent_states.end() != find_if( sent_states.begin(), sent_states.end(), - [&]( const TimestampedState &x ) { return x.num == ack_num; } ) ) { - sent_states.remove_if( [&]( const TimestampedState &x ) { return x.num < ack_num; } ); + (&_1)->*&TimestampedState::num == ack_num ) ) { + sent_states.remove_if( (&_1)->*&TimestampedState::num < ack_num ); } assert( !sent_states.empty() ); @@ -315,7 +317,7 @@ uint64_t TransportSender::get_late_ack( uint64_t now ) } } - ack_history.remove_if( [&]( const pair &x ) { return x.first < newest_echo_ack; } ); + ack_history.remove_if( (&_1)->*&pair::first < newest_echo_ack ); return newest_echo_ack; }