Replace C++0x auto with Boost Typeof library

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg
2012-02-17 19:41:25 -05:00
parent bd3ffb85d5
commit 7d19fbe203
4 changed files with 24 additions and 20 deletions
+4 -3
View File
@@ -17,6 +17,7 @@
*/
#include <boost/lambda/lambda.hpp>
#include <boost/typeof/typeof.hpp>
#include <algorithm>
#include <list>
#include <stdio.h>
@@ -162,7 +163,7 @@ void TransportSender<MyState>::add_sent_state( uint64_t the_timestamp, uint64_t
{
sent_states.push_back( TimestampedState<MyState>( the_timestamp, num, state ) );
if ( sent_states.size() > 32 ) { /* limit on state queue */
auto last = sent_states.end();
BOOST_AUTO( last, sent_states.end() );
for ( int i = 0; i < 16; i++ ) { last--; }
sent_states.erase( last ); /* erase state from middle of queue */
}
@@ -259,7 +260,7 @@ void TransportSender<MyState>::send_in_fragments( string diff, uint64_t new_num
vector<Fragment> fragments = fragmenter.make_fragments( inst, connection->get_MTU() );
for ( auto i = fragments.begin(); i != fragments.end(); i++ ) {
for ( BOOST_AUTO( i, fragments.begin() ); i != fragments.end(); i++ ) {
connection->send( i->tostring() );
if ( verbose ) {
@@ -311,7 +312,7 @@ uint64_t TransportSender<MyState>::get_late_ack( uint64_t now )
{
uint64_t newest_echo_ack = 0;
for ( auto i = ack_history.begin(); i != ack_history.end(); i++ ) {
for ( BOOST_AUTO( i, ack_history.begin() ); i != ack_history.end(); i++ ) {
if ( i->second < now - ECHO_TIMEOUT ) {
newest_echo_ack = i->first;
}