diff options
author | Karl-Johan Alm <karljohan-alm@garage.co.jp> | 2018-07-17 14:05:04 +0900 |
---|---|---|
committer | Karl-Johan Alm <karljohan-alm@garage.co.jp> | 2018-07-24 15:05:36 +0900 |
commit | 173e18a289088c6087ba6fac708e322aa63b7a94 (patch) | |
tree | a1f2e1c3909b8315ebf98f97904dc401b7fbe5d4 | |
parent | 07ce278455757fb46dab95fb9b97a3f6b1b84faf (diff) |
utils: Add insert() convenience templates
-rw-r--r-- | src/util.h | 14 |
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 |