diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-02-02 18:16:38 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-02-02 18:16:39 +0200 |
commit | f9e60dcd551b9f5b4a86a730d0abfc97a6767519 (patch) | |
tree | e1613849aa7a66b11876a03b081c4cc4f6450ca8 /src/p2p | |
parent | Merge pull request #1614 (diff) | |
parent | Remove boost/foreach.cpp includes (diff) | |
download | monero-f9e60dcd551b9f5b4a86a730d0abfc97a6767519.tar.xz |
Merge pull request #1617
0644eed7 Remove boost/foreach.cpp includes (Miguel Herranz)
36dd3e23 Replace BOOST_REVERSE_FOREACH with ranged for (Miguel Herranz)
629e3101 Replace BOOST_FOREACH with C++11 ranged for (Miguel Herranz)
Diffstat (limited to 'src/p2p')
-rw-r--r-- | src/p2p/connection_basic.cpp | 1 | ||||
-rw-r--r-- | src/p2p/net_node.h | 1 | ||||
-rw-r--r-- | src/p2p/net_node.inl | 4 | ||||
-rw-r--r-- | src/p2p/net_peerlist.h | 10 | ||||
-rw-r--r-- | src/p2p/network_throttle-detail.cpp | 1 | ||||
-rw-r--r-- | src/p2p/network_throttle.hpp | 1 | ||||
-rw-r--r-- | src/p2p/p2p_protocol_defs.h | 2 |
7 files changed, 8 insertions, 12 deletions
diff --git a/src/p2p/connection_basic.cpp b/src/p2p/connection_basic.cpp index 80915e9a3..bdb239ca8 100644 --- a/src/p2p/connection_basic.cpp +++ b/src/p2p/connection_basic.cpp @@ -56,7 +56,6 @@ #include "../../contrib/epee/include/net/net_utils_base.h" #include "../../contrib/epee/include/misc_log_ex.h" #include <boost/lambda/bind.hpp> -#include <boost/foreach.hpp> #include <boost/lambda/lambda.hpp> #include <boost/uuid/random_generator.hpp> #include <boost/chrono.hpp> diff --git a/src/p2p/net_node.h b/src/p2p/net_node.h index 40598fc0f..5ed96c00b 100644 --- a/src/p2p/net_node.h +++ b/src/p2p/net_node.h @@ -31,7 +31,6 @@ #pragma once #include <boost/thread.hpp> #include <boost/bind.hpp> -#include <boost/foreach.hpp> #include <boost/bimap.hpp> #include <boost/multi_index_container.hpp> #include <boost/multi_index/ordered_index.hpp> diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index 0e43d9579..d67c5dd93 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -1182,7 +1182,7 @@ namespace nodetool time(&now); delta = now - local_time; - BOOST_FOREACH(peerlist_entry& be, local_peerlist) + for(peerlist_entry& be: local_peerlist) { if(be.last_seen > local_time) { @@ -1320,7 +1320,7 @@ namespace nodetool template<class t_payload_net_handler> bool node_server<t_payload_net_handler>::relay_notify_to_list(int command, const std::string& data_buff, const std::list<boost::uuids::uuid> &connections) { - BOOST_FOREACH(const auto& c_id, connections) + for(const auto& c_id: connections) { m_net_server.get_config_object().notify(command, data_buff, c_id); } diff --git a/src/p2p/net_peerlist.h b/src/p2p/net_peerlist.h index 160206ed3..c73d6615d 100644 --- a/src/p2p/net_peerlist.h +++ b/src/p2p/net_peerlist.h @@ -33,7 +33,6 @@ #include <list> #include <set> #include <map> -#include <boost/foreach.hpp> //#include <boost/bimap.hpp> //#include <boost/bimap/multiset_of.hpp> #include <boost/archive/binary_iarchive.hpp> @@ -45,6 +44,7 @@ #include <boost/multi_index/ordered_index.hpp> #include <boost/multi_index/identity.hpp> #include <boost/multi_index/member.hpp> +#include <boost/range/adaptor/reversed.hpp> #include "syncobj.h" @@ -230,7 +230,7 @@ namespace nodetool bool peerlist_manager::merge_peerlist(const std::list<peerlist_entry>& outer_bs) { CRITICAL_REGION_LOCAL(m_peerlist_lock); - BOOST_FOREACH(const peerlist_entry& be, outer_bs) + for(const peerlist_entry& be: outer_bs) { append_with_peer_gray(be); } @@ -283,7 +283,7 @@ namespace nodetool CRITICAL_REGION_LOCAL(m_peerlist_lock); peers_indexed::index<by_time>::type& by_time_index=m_peers_white.get<by_time>(); uint32_t cnt = 0; - BOOST_REVERSE_FOREACH(const peers_indexed::value_type& vl, by_time_index) + for(const peers_indexed::value_type& vl: boost::adaptors::reverse(by_time_index)) { if(!vl.last_seen) continue; @@ -301,13 +301,13 @@ namespace nodetool { CRITICAL_REGION_LOCAL(m_peerlist_lock); peers_indexed::index<by_time>::type& by_time_index_gr=m_peers_gray.get<by_time>(); - BOOST_REVERSE_FOREACH(const peers_indexed::value_type& vl, by_time_index_gr) + for(const peers_indexed::value_type& vl: boost::adaptors::reverse(by_time_index_gr)) { pl_gray.push_back(vl); } peers_indexed::index<by_time>::type& by_time_index_wt=m_peers_white.get<by_time>(); - BOOST_REVERSE_FOREACH(const peers_indexed::value_type& vl, by_time_index_wt) + for(const peers_indexed::value_type& vl: boost::adaptors::reverse(by_time_index_wt)) { pl_white.push_back(vl); } diff --git a/src/p2p/network_throttle-detail.cpp b/src/p2p/network_throttle-detail.cpp index 9efaaf95a..d4fe356a9 100644 --- a/src/p2p/network_throttle-detail.cpp +++ b/src/p2p/network_throttle-detail.cpp @@ -54,7 +54,6 @@ #include "../../contrib/epee/include/net/net_utils_base.h" #include "../../contrib/epee/include/misc_log_ex.h" #include <boost/lambda/bind.hpp> -#include <boost/foreach.hpp> #include <boost/lambda/lambda.hpp> #include <boost/uuid/random_generator.hpp> #include <boost/chrono.hpp> diff --git a/src/p2p/network_throttle.hpp b/src/p2p/network_throttle.hpp index b954c5b3a..4f6cbe9cf 100644 --- a/src/p2p/network_throttle.hpp +++ b/src/p2p/network_throttle.hpp @@ -57,7 +57,6 @@ #include "../../contrib/epee/include/net/net_utils_base.h" #include "../../contrib/epee/include/misc_log_ex.h" #include <boost/lambda/bind.hpp> -#include <boost/foreach.hpp> #include <boost/lambda/lambda.hpp> #include <boost/uuid/random_generator.hpp> #include <boost/chrono.hpp> diff --git a/src/p2p/p2p_protocol_defs.h b/src/p2p/p2p_protocol_defs.h index ce1ee1449..6d6ac7b98 100644 --- a/src/p2p/p2p_protocol_defs.h +++ b/src/p2p/p2p_protocol_defs.h @@ -83,7 +83,7 @@ namespace nodetool time(&now_time); std::stringstream ss; ss << std::setfill ('0') << std::setw (8) << std::hex << std::noshowbase; - BOOST_FOREACH(const peerlist_entry& pe, pl) + for(const peerlist_entry& pe: pl) { ss << pe.id << "\t" << epee::string_tools::get_ip_string_from_int32(pe.adr.ip) << ":" << boost::lexical_cast<std::string>(pe.adr.port) << " \tlast_seen: " << epee::misc_utils::get_time_interval_string(now_time - pe.last_seen) << std::endl; } |