Skip to content

Commit

Permalink
Merge pull request #178 from 420coupe/boost-1.73
Browse files Browse the repository at this point in the history
followed commit monero-project#6612 on xmr
  • Loading branch information
aeonix authored Jun 2, 2020
2 parents c3763a1 + 56418a6 commit d6276c4
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 39 deletions.
4 changes: 2 additions & 2 deletions contrib/epee/include/console_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ namespace epee
bool run_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, std::function<std::string(void)> prompt, const std::string& usage = "")
{
async_console_handler console_handler;
return console_handler.run(ptsrv, boost::bind<bool>(no_srv_param_adapter<t_server, t_handler>, _1, _2, handlr), prompt, usage);
return console_handler.run(ptsrv, std::bind<bool>(no_srv_param_adapter<t_server, t_handler>, std::placeholders::_1, std::placeholders::_2, handlr), prompt, usage);
}

template<class t_server, class t_handler>
Expand Down Expand Up @@ -560,7 +560,7 @@ namespace epee

bool run_handling(std::function<std::string(void)> prompt, const std::string& usage_string, std::function<void(void)> exit_handler = NULL)
{
return m_console_handler.run(boost::bind(&console_handlers_binder::process_command_str, this, _1), prompt, usage_string, exit_handler);
return m_console_handler.run(std::bind(&console_handlers_binder::process_command_str, this, std::placeholders::_1), prompt, usage_string, exit_handler);
}

void print_prompt()
Expand Down
32 changes: 16 additions & 16 deletions contrib/epee/include/net/abstract_tcp_server2.inl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@


//#include "net_utils_base.h"
#include <boost/lambda/bind.hpp>
//#include <boost/lambda/bind.hpp>
#include <boost/foreach.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/uuid/random_generator.hpp>
Expand Down Expand Up @@ -181,9 +181,9 @@ PRAGMA_WARNING_DISABLE_VS(4355)

socket_.async_read_some(boost::asio::buffer(buffer_),
strand_.wrap(
boost::bind(&connection<t_protocol_handler>::handle_read, self,
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred)));
std::bind(&connection<t_protocol_handler>::handle_read, self,
std::placeholders::_1,
std::placeholders::_2)));
#if !defined(_WIN32) || !defined(__i686)
// not supported before Windows7, too lazy for runtime check
// Just exclude for 32bit windows builds
Expand Down Expand Up @@ -354,9 +354,9 @@ PRAGMA_WARNING_DISABLE_VS(4355)
reset_timer(get_timeout_from_bytes_read(bytes_transferred), false);
socket_.async_read_some(boost::asio::buffer(buffer_),
strand_.wrap(
boost::bind(&connection<t_protocol_handler>::handle_read, connection<t_protocol_handler>::shared_from_this(),
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred)));
std::bind(&connection<t_protocol_handler>::handle_read, connection<t_protocol_handler>::shared_from_this(),
std::placeholders::_1,
std::placeholders::_2)));
//_info("[sock " << socket_.native_handle() << "]Async read requested.");
}
}else
Expand Down Expand Up @@ -572,7 +572,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
reset_timer(get_default_timeout(), false);
boost::asio::async_write(socket_, boost::asio::buffer(m_send_que.front().data(), size_now ) ,
//strand_.wrap(
boost::bind(&connection<t_protocol_handler>::handle_write, self, _1, _2)
std::bind(&connection<t_protocol_handler>::handle_write, self, std::placeholders::_1, std::placeholders::_2)
//)
);
//_dbg3("(chunk): " << size_now);
Expand Down Expand Up @@ -756,7 +756,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
CHECK_AND_ASSERT_MES( size_now == m_send_que.front().size(), void(), "Unexpected queue size");
boost::asio::async_write(socket_, boost::asio::buffer(m_send_que.front().data(), size_now) ,
// strand_.wrap(
boost::bind(&connection<t_protocol_handler>::handle_write, connection<t_protocol_handler>::shared_from_this(), _1, _2)
std::bind(&connection<t_protocol_handler>::handle_write, connection<t_protocol_handler>::shared_from_this(), std::placeholders::_1, std::placeholders::_2)
// )
);
//_dbg3("(normal)" << size_now);
Expand Down Expand Up @@ -852,8 +852,8 @@ PRAGMA_WARNING_DISABLE_VS(4355)
MDEBUG("start accept");
new_connection_.reset(new connection<t_protocol_handler>(io_service_, m_config, m_sock_count, m_sock_number, m_pfilter, m_connection_type));
acceptor_.async_accept(new_connection_->socket(),
boost::bind(&boosted_tcp_server<t_protocol_handler>::handle_accept, this,
boost::asio::placeholders::error));
std::bind(&boosted_tcp_server<t_protocol_handler>::handle_accept, this,
std::placeholders::_1));

return true;
}
Expand Down Expand Up @@ -1054,8 +1054,8 @@ POP_WARNINGS
connection_ptr conn(std::move(new_connection_));
new_connection_.reset(new connection<t_protocol_handler>(io_service_, m_config, m_sock_count, m_sock_number, m_pfilter, m_connection_type));
acceptor_.async_accept(new_connection_->socket(),
boost::bind(&boosted_tcp_server<t_protocol_handler>::handle_accept, this,
boost::asio::placeholders::error));
std::bind(&boosted_tcp_server<t_protocol_handler>::handle_accept, this,
std::placeholders::_1));

boost::asio::socket_base::keep_alive opt(true);
conn->socket().set_option(opt);
Expand All @@ -1079,8 +1079,8 @@ POP_WARNINGS
misc_utils::sleep_no_w(100);
new_connection_.reset(new connection<t_protocol_handler>(io_service_, m_config, m_sock_count, m_sock_number, m_pfilter, m_connection_type));
acceptor_.async_accept(new_connection_->socket(),
boost::bind(&boosted_tcp_server<t_protocol_handler>::handle_accept, this,
boost::asio::placeholders::error));
std::bind(&boosted_tcp_server<t_protocol_handler>::handle_accept, this,
std::placeholders::_1));
}
//---------------------------------------------------------------------------------
template<class t_protocol_handler>
Expand Down Expand Up @@ -1141,7 +1141,7 @@ POP_WARNINGS
shared_context->connect_mut.lock(); shared_context->ec = ec_; shared_context->cond.notify_one(); shared_context->connect_mut.unlock();
};

sock_.async_connect(remote_endpoint, boost::bind<void>(connect_callback, _1, local_shared_context));
sock_.async_connect(remote_endpoint, std::bind<void>(connect_callback, std::placeholders::_1, local_shared_context));
while(local_shared_context->ec == boost::asio::error::would_block)
{
bool r = local_shared_context->cond.timed_wait(lock, boost::get_system_time() + boost::posix_time::milliseconds(conn_timeout));
Expand Down
2 changes: 1 addition & 1 deletion contrib/epee/include/net/http_server_impl_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@


#include <boost/thread.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>

#include "net/http_server_cp2.h"
#include "net/http_server_handlers_map2.h"
Expand Down
9 changes: 5 additions & 4 deletions contrib/epee/include/storages/levin_abstract_invoke2.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include "portable_storage_template_helper.h"
#include <boost/utility/value_init.hpp>
#include <functional>
#include "net/levin_base.h"

#undef MONERO_DEFAULT_LOG_CATEGORY
Expand Down Expand Up @@ -256,20 +257,20 @@ namespace epee

#define HANDLE_INVOKE2(command_id, func, type_name_in, typename_out) \
if(!is_notify && command_id == command) \
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, type_name_in, typename_out>(this, command, in_buff, buff_out, boost::bind(func, this, _1, _2, _3, _4), context);}
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, type_name_in, typename_out>(this, command, in_buff, buff_out, std::bind(func, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4), context);}

#define HANDLE_INVOKE_T2(COMMAND, func) \
if(!is_notify && COMMAND::ID == command) \
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, typename COMMAND::request, typename COMMAND::response>(command, in_buff, buff_out, boost::bind(func, this, _1, _2, _3, _4), context);}
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, typename COMMAND::request, typename COMMAND::response>(command, in_buff, buff_out, std::bind(func, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4), context);}


#define HANDLE_NOTIFY2(command_id, func, type_name_in) \
if(is_notify && command_id == command) \
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, type_name_in>(this, command, in_buff, boost::bind(func, this, _1, _2, _3), context);}
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, type_name_in>(this, command, in_buff, std::bind(func, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), context);}

#define HANDLE_NOTIFY_T2(NOTIFY, func) \
if(is_notify && NOTIFY::ID == command) \
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, typename NOTIFY::request>(this, command, in_buff, boost::bind(func, this, _1, _2, _3), context);}
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, typename NOTIFY::request>(this, command, in_buff, std::bind(func, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), context);}


#define CHAIN_INVOKE_MAP2(func) \
Expand Down
1 change: 0 additions & 1 deletion src/blockchain_utilities/blocksdat_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <boost/iostreams/copy.hpp>
#include <atomic>

#include "common/command_line.h"
Expand Down
1 change: 0 additions & 1 deletion src/blockchain_utilities/bootstrap_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <boost/iostreams/copy.hpp>
#include <atomic>

#include "common/command_line.h"
Expand Down
9 changes: 4 additions & 5 deletions src/checkpoints/checkpoints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ using namespace epee;
#include "common/dns_utils.h"
#include "include_base_utils.h"
#include "string_tools.h"
#include <functional>
#include "storages/portable_storage_template_helper.h" // epee json include
#include "serialization/keyvalue_serialization.h"

Expand Down Expand Up @@ -135,11 +136,9 @@ namespace cryptonote
//---------------------------------------------------------------------------
uint64_t checkpoints::get_max_height() const
{
std::map< uint64_t, crypto::hash >::const_iterator highest =
std::max_element( m_points.begin(), m_points.end(),
( boost::bind(&std::map< uint64_t, crypto::hash >::value_type::first, _1) <
boost::bind(&std::map< uint64_t, crypto::hash >::value_type::first, _2 ) ) );
return highest->first;
if (m_points.empty())
return 0;
return m_points.rbegin()->first;
}
//---------------------------------------------------------------------------
const std::map<uint64_t, crypto::hash>& checkpoints::get_points() const
Expand Down
2 changes: 1 addition & 1 deletion src/p2p/net_node.inl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <algorithm>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/thread/thread.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <atomic>

#include "version.h"
Expand Down
4 changes: 2 additions & 2 deletions src/rpc/rpc_args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#include <boost/algorithm/string.hpp>
#include <boost/asio/ip/address.hpp>
#include <boost/bind.hpp>
#include <functional>
#include "common/command_line.h"
#include "common/i18n.h"

Expand Down Expand Up @@ -108,7 +108,7 @@ namespace cryptonote

std::vector<std::string> access_control_origins;
boost::split(access_control_origins, access_control_origins_input, boost::is_any_of(","));
std::for_each(access_control_origins.begin(), access_control_origins.end(), boost::bind(&boost::trim<std::string>, _1, std::locale::classic()));
std::for_each(access_control_origins.begin(), access_control_origins.end(), std::bind(&boost::trim<std::string>, std::placeholders::_1, std::locale::classic()));
config.access_control_origins = std::move(access_control_origins);
}

Expand Down
3 changes: 3 additions & 0 deletions src/simplewallet/simplewallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
*
* \brief Source file that defines simple_wallet class.
*/
// use boost bind placeholders for now
#define BOOST_BIND_GLOBAL_PLACEHOLDERS 1
#include <boost/bind.hpp>
#include <thread>
#include <iostream>
#include <sstream>
Expand Down
6 changes: 3 additions & 3 deletions src/wallet/wallet2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
// the first one was already checked
for (size_t i = 1; i < tx.vout.size(); ++i)
{
tpool.submit(&waiter, boost::bind(&wallet2::check_acc_out_precomp_once, this, std::cref(tx.vout[i]), std::cref(derivation), std::cref(additional_derivations), i,
tpool.submit(&waiter, std::bind(&wallet2::check_acc_out_precomp_once, this, std::cref(tx.vout[i]), std::cref(derivation), std::cref(additional_derivations), i,
std::cref(is_out_data_ptr), std::ref(tx_scan_info[i]), std::ref(output_found[i])), true);
}
waiter.wait(&tpool);
Expand All @@ -1438,7 +1438,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
{
for (size_t i = 0; i < tx.vout.size(); ++i)
{
tpool.submit(&waiter, boost::bind(&wallet2::check_acc_out_precomp_once, this, std::cref(tx.vout[i]), std::cref(derivation), std::cref(additional_derivations), i,
tpool.submit(&waiter, std::bind(&wallet2::check_acc_out_precomp_once, this, std::cref(tx.vout[i]), std::cref(derivation), std::cref(additional_derivations), i,
std::cref(is_out_data_ptr), std::ref(tx_scan_info[i]), std::ref(output_found[i])), true);
}
waiter.wait(&tpool);
Expand Down Expand Up @@ -2146,7 +2146,7 @@ void wallet2::pull_and_parse_next_blocks(uint64_t start_height, uint64_t &blocks
parsed_blocks.resize(blocks.size());
for (size_t i = 0; i < blocks.size(); ++i)
{
tpool.submit(&waiter, boost::bind(&wallet2::parse_block_round, this, std::cref(blocks[i].block),
tpool.submit(&waiter, std::bind(&wallet2::parse_block_round, this, std::cref(blocks[i].block),
std::ref(parsed_blocks[i].block), std::ref(parsed_blocks[i].hash), std::ref(parsed_blocks[i].error)), true);
}
waiter.wait(&tpool);
Expand Down
6 changes: 3 additions & 3 deletions tests/core_tests/chaingen.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers

#pragma once

#include <functional>
#include <vector>
#include <iostream>
#include <stdint.h>
Expand Down Expand Up @@ -612,10 +612,10 @@ inline bool do_replay_file(const std::string& filename)
}

#define REGISTER_CALLBACK(CB_NAME, CLBACK) \
register_callback(CB_NAME, boost::bind(&CLBACK, this, _1, _2, _3));
register_callback(CB_NAME, std::bind(&CLBACK, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));

#define REGISTER_CALLBACK_METHOD(CLASS, METHOD) \
register_callback(#METHOD, boost::bind(&CLASS::METHOD, this, _1, _2, _3));
register_callback(#METHOD, std::bind(&CLASS::METHOD, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));

#define MAKE_GENESIS_BLOCK(VEC_EVENTS, BLK_NAME, MINER_ACC, TS) \
test_generator generator; \
Expand Down

0 comments on commit d6276c4

Please sign in to comment.