diff --git a/src/bench/bench.h b/src/bench/bench.h index 445be56d9..0ffd3ef8e 100644 --- a/src/bench/bench.h +++ b/src/bench/bench.h @@ -7,7 +7,7 @@ #include // for uint64_t -#include // for function +#include // for std::function #include // for BOOST_PP_CAT #include // for BOOST_PP_STRINGIZE @@ -62,7 +62,7 @@ namespace benchmark { bool KeepRunning(); }; - typedef boost::function BenchFunction; + typedef std::function BenchFunction; class BenchRunner { diff --git a/src/httprpc.cpp b/src/httprpc.cpp index 8ac6925ac..054c0d6fa 100644 --- a/src/httprpc.cpp +++ b/src/httprpc.cpp @@ -20,6 +20,7 @@ #include // boost::trim #include //BOOST_FOREACH +#include // std::function /** WWW-Authenticate to present with 401 Unauthorized response */ static const char* WWW_AUTH_HEADER_DATA = "Basic realm=\"jsonrpc\""; @@ -30,7 +31,7 @@ static const char* WWW_AUTH_HEADER_DATA = "Basic realm=\"jsonrpc\""; 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; @@ -52,7 +53,7 @@ public: { 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 index 28a9e899e..2c670fe01 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -58,12 +58,13 @@ #include #include #include -#include #include #include #include #include +#include // for std::function + #if ENABLE_ZMQ #include "zmq/zmqnotificationinterface.h" #endif diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 1997a9aaa..3377cddb5 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -42,6 +42,7 @@ #include #include #include +#include // TODO: add a scrollback limit, as there is currently none // TODO: make it possible to filter out categories (esp debug messages when implemented) @@ -97,7 +98,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); @@ -109,7 +110,7 @@ private Q_SLOTS: void timeout() { func(); } private: QTimer timer; - boost::function func; + std::function func; }; class QtRPCTimerInterface: public RPCTimerInterface @@ -117,7 +118,7 @@ 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.cpp b/src/rpc/server.cpp index 29e38c107..481b2fd38 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -23,6 +23,7 @@ #include #include // for to_upper() +#include // for std::function #include // for unique_ptr #include @@ -46,22 +47,22 @@ static struct CRPCSignals 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, boost::placeholders::_1)); } -void RPCServer::OnPostCommand(boost::function slot) +void RPCServer::OnPostCommand(std::function slot) { g_rpcSignals.PostCommand.connect(boost::bind(slot, boost::placeholders::_1)); } @@ -566,7 +567,7 @@ void RPCUnsetTimerInterface(RPCTimerInterface *iface) timerInterface = NULL; } -void RPCRunLater(const std::string& name, boost::function func, int64_t nSeconds) +void RPCRunLater(const std::string& name, std::function func, int64_t nSeconds) { if (!timerInterface) throw JSONRPCError(RPC_INTERNAL_ERROR, "No timer handler registered for RPC"); diff --git a/src/rpc/server.h b/src/rpc/server.h index 84ca9c1b6..41f61c91d 100644 --- a/src/rpc/server.h +++ b/src/rpc/server.h @@ -17,7 +17,7 @@ #include #include -#include +#include #include @@ -28,10 +28,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; @@ -119,7 +119,7 @@ public: * This is needed to cope with the case in which there is no HTTP server, but * only GUI RPC console, and to break the dependency of pcserver on httprpc. */ - virtual RPCTimerBase* NewTimer(boost::function& func, int64_t millis) = 0; + virtual RPCTimerBase* NewTimer(std::function& func, int64_t millis) = 0; }; /** Set the factory function for timers */ @@ -133,7 +133,7 @@ void RPCUnsetTimerInterface(RPCTimerInterface *iface); * Run func nSeconds from now. * Overrides previous timer (if any). */ -void RPCRunLater(const std::string& name, boost::function func, int64_t nSeconds); +void RPCRunLater(const std::string& name, std::function func, int64_t nSeconds); typedef UniValue(*rpcfn_type)(const JSONRPCRequest& jsonRequest); diff --git a/src/scheduler.h b/src/scheduler.h index 436659e58..439e56cc2 100644 --- a/src/scheduler.h +++ b/src/scheduler.h @@ -10,7 +10,7 @@ // boost::thread / boost::function / boost::chrono should be ported to // std::thread / std::function / std::chrono when we support C++11. // -#include +#include #include #include #include @@ -39,7 +39,7 @@ public: 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 index 792d23a86..1ee5fb9ec 100644 --- a/src/torcontrol.cpp +++ b/src/torcontrol.cpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include #include @@ -74,8 +74,8 @@ public: class TorControlConnection { public: - typedef boost::function ConnectionCB; - typedef boost::function ReplyHandlerCB; + typedef std::function ConnectionCB; + typedef std::function ReplyHandlerCB; /** Create a new TorControlConnection. */ @@ -106,9 +106,9 @@ public: boost::signals2::signal async_handler; 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.cpp b/src/txdb.cpp index b27ad8010..3f3ae1627 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -173,7 +173,7 @@ bool CBlockTreeDB::ReadFlag(const std::string &name, bool &fValue) { return true; } -bool CBlockTreeDB::LoadBlockIndexGuts(boost::function insertBlockIndex) +bool CBlockTreeDB::LoadBlockIndexGuts(std::function insertBlockIndex) { std::unique_ptr pcursor(NewIterator()); diff --git a/src/txdb.h b/src/txdb.h index d9214ba61..b445b0de1 100644 --- a/src/txdb.h +++ b/src/txdb.h @@ -14,8 +14,7 @@ #include #include #include - -#include +#include class CBlockIndex; class CCoinsViewDBCursor; @@ -122,7 +121,7 @@ public: bool WriteTxIndex(const std::vector > &list); bool WriteFlag(const std::string &name, bool fValue); bool ReadFlag(const std::string &name, bool &fValue); - bool LoadBlockIndexGuts(boost::function insertBlockIndex); + bool LoadBlockIndexGuts(std::function insertBlockIndex); }; #endif // BITCOIN_TXDB_H