aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar John Hood <cgull@glup.org>2018-07-21 23:41:48 -0400
committerGravatar John Hood <cgull@glup.org>2018-08-03 16:13:47 -0400
commit8ac80db41980a98f99c4e077d8ec436095f7490c (patch)
treea760b305229a894e9af8e4abeb993c216ac434f4 /src
parentace6324a77319294c96a2bec6c196b56eba6407f (diff)
C++03 bound functions are not available in C++17; remove
This makes me a little sad, it's time to move to C++11 or greater.
Diffstat (limited to 'src')
-rw-r--r--src/frontend/terminaloverlay.cc21
-rw-r--r--src/frontend/terminaloverlay.h3
-rw-r--r--src/network/transportsender-impl.h19
-rw-r--r--src/network/transportstate.h4
-rw-r--r--src/statesync/completeterminal.cc15
5 files changed, 39 insertions, 23 deletions
diff --git a/src/frontend/terminaloverlay.cc b/src/frontend/terminaloverlay.cc
index b1c906a..b1d1fc7 100644
--- a/src/frontend/terminaloverlay.cc
+++ b/src/frontend/terminaloverlay.cc
@@ -40,8 +40,6 @@
using namespace Overlay;
using std::max;
-using std::mem_fun_ref;
-using std::bind2nd;
void ConditionalOverlayCell::apply( Framebuffer &fb, uint64_t confirmed_epoch, int row, bool flag ) const
{
@@ -380,7 +378,14 @@ void PredictionEngine::apply( Framebuffer &fb ) const
void PredictionEngine::kill_epoch( uint64_t epoch, const Framebuffer &fb )
{
- cursors.remove_if( bind2nd( mem_fun_ref( &ConditionalCursorMove::tentative ), epoch - 1 ) );
+ for( cursors_type::const_iterator it = cursors.begin(); it != cursors.end(); ) {
+ cursors_type::const_iterator it_next = it;
+ it_next++;
+ if ( it->tentative( epoch - 1 )) {
+ cursors.erase( it );
+ }
+ it = it_next;
+ }
cursors.push_back( ConditionalCursorMove( local_frame_sent + 1,
fb.ds.get_cursor_row(),
@@ -623,9 +628,13 @@ void PredictionEngine::cull( const Framebuffer &fb )
ConditionalOverlayRow & PredictionEngine::get_or_make_row( int row_num, int num_cols )
{
- overlays_type::iterator it =
- find_if( overlays.begin(), overlays.end(),
- bind2nd( mem_fun_ref( &ConditionalOverlayRow::row_num_eq ), row_num ) );
+ overlays_type::iterator it;
+
+ for ( it = overlays.begin(); it != overlays.end(); it++ ) {
+ if ( it->row_num == row_num ) {
+ break;
+ }
+ }
if ( it != overlays.end() ) {
return *it;
diff --git a/src/frontend/terminaloverlay.h b/src/frontend/terminaloverlay.h
index a76fb20..84421eb 100644
--- a/src/frontend/terminaloverlay.h
+++ b/src/frontend/terminaloverlay.h
@@ -133,9 +133,6 @@ namespace Overlay {
void apply( Framebuffer &fb, uint64_t confirmed_epoch, bool flag ) const;
- /* For use with find_if */
- bool row_num_eq( int v ) const { return row_num == v; }
-
ConditionalOverlayRow( int s_row_num ) : row_num( s_row_num ), overlay_cells() {}
};
diff --git a/src/network/transportsender-impl.h b/src/network/transportsender-impl.h
index e9e4b6d..1886388 100644
--- a/src/network/transportsender-impl.h
+++ b/src/network/transportsender-impl.h
@@ -360,12 +360,23 @@ void TransportSender<MyState>::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(),
- bind2nd( mem_fun_ref( &TimestampedState<MyState>::num_eq ), ack_num ) ) ) {
- sent_states.remove_if( bind2nd( mem_fun_ref( &TimestampedState<MyState>::num_lt ), ack_num ) );
+ typename sent_states_type::const_iterator i;
+ for ( i = sent_states.begin(); i != sent_states.end(); i++ ) {
+ if ( i->num == ack_num ) {
+ break;
+ }
}
+ if ( i != sent_states.end() ) {
+ for ( i = sent_states.begin(); i != sent_states.end(); ) {
+ typename sent_states_type::const_iterator i_next = i;
+ i_next++;
+ if ( i->num < ack_num ) {
+ sent_states.erase( i );
+ }
+ i = i_next;
+ }
+ }
assert( !sent_states.empty() );
}
diff --git a/src/network/transportstate.h b/src/network/transportstate.h
index 9c52b69..2e4179d 100644
--- a/src/network/transportstate.h
+++ b/src/network/transportstate.h
@@ -45,10 +45,6 @@ namespace Network {
TimestampedState( uint64_t s_timestamp, uint64_t s_num, const State &s_state )
: timestamp( s_timestamp ), num( s_num ), state( s_state )
{}
-
- /* For use with find_if, remove_if */
- bool num_eq( uint64_t v ) const { return num == v; }
- bool num_lt( uint64_t v ) const { return num < v; }
};
}
diff --git a/src/statesync/completeterminal.cc b/src/statesync/completeterminal.cc
index eddfda5..e7ede84 100644
--- a/src/statesync/completeterminal.cc
+++ b/src/statesync/completeterminal.cc
@@ -127,11 +127,6 @@ bool Complete::operator==( Complete const &x ) const
return (terminal == x.terminal) && (echo_ack == x.echo_ack);
}
-static bool old_ack(uint64_t newest_echo_ack, const pair<uint64_t, uint64_t> p)
-{
- return p.first < newest_echo_ack;
-}
-
bool Complete::set_echo_ack( uint64_t now )
{
bool ret = false;
@@ -145,7 +140,15 @@ bool Complete::set_echo_ack( uint64_t now )
}
}
- input_history.remove_if( bind1st( ptr_fun( old_ack ), newest_echo_ack ) );
+ for ( input_history_type::const_iterator i = input_history.begin();
+ i != input_history.end(); ) {
+ input_history_type::const_iterator i_next = i;
+ i_next++;
+ if ( i->first < newest_echo_ack ) {
+ input_history.erase( i );
+ }
+ i = i_next;
+ }
if ( echo_ack != newest_echo_ack ) {
ret = true;