aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/util.h b/src/util.h
index 8094d72d6b..23b2a787e4 100644
--- a/src/util.h
+++ b/src/util.h
@@ -1,5 +1,5 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2017 The Bitcoin Core developers
+// Copyright (c) 2009-2018 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -20,11 +20,11 @@
#include <sync.h>
#include <tinyformat.h>
#include <utiltime.h>
+#include <utilmemory.h>
#include <atomic>
#include <exception>
#include <map>
-#include <memory>
#include <set>
#include <stdint.h>
#include <string>
@@ -276,12 +276,12 @@ public:
/**
* Get the help string
*/
- std::string GetHelpMessage();
+ std::string GetHelpMessage() const;
/**
* Check whether we know of this arg
*/
- bool IsArgKnown(const std::string& key, std::string& error);
+ bool IsArgKnown(const std::string& key) const;
};
extern ArgsManager gArgs;
@@ -346,13 +346,6 @@ template <typename Callable> void TraceThread(const char* name, Callable func)
std::string CopyrightHolders(const std::string& strPrefix);
-//! Substitute for C++14 std::make_unique.
-template <typename T, typename... Args>
-std::unique_ptr<T> MakeUnique(Args&&... args)
-{
- return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
-}
-
/**
* On platforms that support it, tell the kernel the calling thread is
* CPU-intensive and non-interactive. See SCHED_BATCH in sched(7) for details.
@@ -362,4 +355,18 @@ std::unique_ptr<T> MakeUnique(Args&&... args)
*/
int ScheduleBatchPriority(void);
+namespace util {
+
+//! Simplification of std insertion
+template <typename Tdst, typename Tsrc>
+inline void insert(Tdst& dst, const Tsrc& src) {
+ dst.insert(dst.begin(), src.begin(), src.end());
+}
+template <typename TsetT, typename Tsrc>
+inline void insert(std::set<TsetT>& dst, const Tsrc& src) {
+ dst.insert(src.begin(), src.end());
+}
+
+} // namespace util
+
#endif // BITCOIN_UTIL_H