diff --git a/src/bench/bench.h b/src/bench/bench.h --- a/src/bench/bench.h +++ b/src/bench/bench.h @@ -5,10 +5,11 @@ #ifndef BITCOIN_BENCH_BENCH_H #define BITCOIN_BENCH_BENCH_H +#include +#include #include #include -#include #include #include @@ -61,7 +62,7 @@ bool KeepRunning(); }; -typedef boost::function BenchFunction; +typedef std::function BenchFunction; class BenchRunner { typedef std::map BenchmarkMap; diff --git a/src/httprpc.cpp b/src/httprpc.cpp --- a/src/httprpc.cpp +++ b/src/httprpc.cpp @@ -30,8 +30,8 @@ */ class HTTPRPCTimer : public RPCTimerBase { public: - HTTPRPCTimer(struct event_base *eventBase, - boost::function &func, int64_t millis) + HTTPRPCTimer(struct event_base *eventBase, std::function &func, + int64_t millis) : ev(eventBase, false, func) { struct timeval tv; tv.tv_sec = millis / 1000; @@ -47,7 +47,7 @@ public: HTTPRPCTimerInterface(struct event_base *_base) : base(_base) {} const char *Name() { return "HTTP"; } - RPCTimerBase *NewTimer(boost::function &func, int64_t millis) { + RPCTimerBase *NewTimer(std::function &func, int64_t millis) { return new HTTPRPCTimer(base, func, millis); } diff --git a/src/init.cpp b/src/init.cpp --- a/src/init.cpp +++ b/src/init.cpp @@ -58,7 +58,6 @@ #include #include #include -#include #include #include #include diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -94,7 +94,7 @@ class QtRPCTimerBase : public QObject, public RPCTimerBase { Q_OBJECT public: - QtRPCTimerBase(boost::function &_func, int64_t millis) + QtRPCTimerBase(std::function &_func, int64_t millis) : func(_func) { timer.setSingleShot(true); connect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); @@ -106,14 +106,14 @@ private: QTimer timer; - boost::function func; + std::function func; }; class QtRPCTimerInterface : public RPCTimerInterface { public: ~QtRPCTimerInterface() {} const char *Name() { return "Qt"; } - RPCTimerBase *NewTimer(boost::function &func, int64_t millis) { + RPCTimerBase *NewTimer(std::function &func, int64_t millis) { return new QtRPCTimerBase(func, millis); } }; diff --git a/src/rpc/server.h b/src/rpc/server.h --- a/src/rpc/server.h +++ b/src/rpc/server.h @@ -16,8 +16,6 @@ #include #include -#include - #include static const unsigned int DEFAULT_RPC_SERIALIZE_VERSION = 1; @@ -25,10 +23,10 @@ class CRPCCommand; namespace RPCServer { -void OnStarted(boost::function slot); -void OnStopped(boost::function slot); -void OnPreCommand(boost::function slot); -void OnPostCommand(boost::function slot); +void OnStarted(std::function slot); +void OnStopped(std::function slot); +void OnPreCommand(std::function slot); +void OnPostCommand(std::function slot); } class CBlockIndex; @@ -123,7 +121,7 @@ * but only GUI RPC console, and to break the dependency of pcserver on * httprpc. */ - virtual RPCTimerBase *NewTimer(boost::function &func, + virtual RPCTimerBase *NewTimer(std::function &func, int64_t millis) = 0; }; @@ -138,7 +136,7 @@ * Run func nSeconds from now. * Overrides previous timer (if any). */ -void RPCRunLater(const std::string &name, boost::function func, +void RPCRunLater(const std::string &name, std::function func, int64_t nSeconds); typedef UniValue (*rpcfn_type)(Config &config, diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -45,19 +45,19 @@ boost::signals2::signal PostCommand; } g_rpcSignals; -void RPCServer::OnStarted(boost::function slot) { +void RPCServer::OnStarted(std::function slot) { g_rpcSignals.Started.connect(slot); } -void RPCServer::OnStopped(boost::function slot) { +void RPCServer::OnStopped(std::function slot) { g_rpcSignals.Stopped.connect(slot); } -void RPCServer::OnPreCommand(boost::function slot) { +void RPCServer::OnPreCommand(std::function slot) { g_rpcSignals.PreCommand.connect(boost::bind(slot, _1)); } -void RPCServer::OnPostCommand(boost::function slot) { +void RPCServer::OnPostCommand(std::function slot) { g_rpcSignals.PostCommand.connect(boost::bind(slot, _1)); } @@ -502,7 +502,7 @@ if (timerInterface == iface) timerInterface = nullptr; } -void RPCRunLater(const std::string &name, boost::function func, +void RPCRunLater(const std::string &name, std::function func, int64_t nSeconds) { if (!timerInterface) throw JSONRPCError(RPC_INTERNAL_ERROR, diff --git a/src/scheduler.h b/src/scheduler.h --- a/src/scheduler.h +++ b/src/scheduler.h @@ -7,11 +7,10 @@ // // NOTE: -// boost::thread / boost::function / boost::chrono should be ported to -// std::thread / std::function / std::chrono when we support C++11. +// boost::thread / boost::chrono should be ported to +// std::thread / std::chrono when we support C++11. // #include -#include #include #include @@ -39,7 +38,7 @@ CScheduler(); ~CScheduler(); - typedef boost::function Function; + typedef std::function Function; // Call func at/after time t void schedule(Function f, boost::chrono::system_clock::time_point t); diff --git a/src/torcontrol.cpp b/src/torcontrol.cpp --- a/src/torcontrol.cpp +++ b/src/torcontrol.cpp @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -74,9 +73,8 @@ */ class TorControlConnection { public: - typedef boost::function ConnectionCB; - typedef boost::function + typedef std::function ConnectionCB; + typedef std::function ReplyHandlerCB; /** Create a new TorControlConnection. @@ -114,9 +112,9 @@ private: /** Callback when ready for use */ - boost::function connected; + std::function connected; /** Callback when connection lost */ - boost::function disconnected; + std::function disconnected; /** Libevent event base */ struct event_base *base; /** Connection to control socket */ diff --git a/src/txdb.h b/src/txdb.h --- a/src/txdb.h +++ b/src/txdb.h @@ -15,8 +15,6 @@ #include #include -#include - class CBlockIndex; class CCoinsViewDBCursor; class uint256; @@ -123,7 +121,7 @@ bool WriteFlag(const std::string &name, bool fValue); bool ReadFlag(const std::string &name, bool &fValue); bool LoadBlockIndexGuts( - boost::function insertBlockIndex); + std::function insertBlockIndex); }; #endif // BITCOIN_TXDB_H diff --git a/src/txdb.cpp b/src/txdb.cpp --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -179,7 +179,7 @@ } bool CBlockTreeDB::LoadBlockIndexGuts( - boost::function insertBlockIndex) { + std::function insertBlockIndex) { std::unique_ptr pcursor(NewIterator()); pcursor->Seek(std::make_pair(DB_BLOCK_INDEX, uint256()));