aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
authorKarl-Johan Alm <karljohan-alm@garage.co.jp>2018-07-17 14:05:04 +0900
committerKarl-Johan Alm <karljohan-alm@garage.co.jp>2018-07-24 15:05:36 +0900
commit173e18a289088c6087ba6fac708e322aa63b7a94 (patch)
treea1f2e1c3909b8315ebf98f97904dc401b7fbe5d4 /src/util.h
parent07ce278455757fb46dab95fb9b97a3f6b1b84faf (diff)
downloadbitcoin-173e18a289088c6087ba6fac708e322aa63b7a94.tar.xz
utils: Add insert() convenience templates
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h
index f8bcc0192c..c3003e66a6 100644
--- a/src/util.h
+++ b/src/util.h
@@ -355,4 +355,18 @@ std::string CopyrightHolders(const std::string& strPrefix);
*/
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