Skip to content

Commit 173e18a

Browse files
committed
utils: Add insert() convenience templates
1 parent 07ce278 commit 173e18a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/util.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,4 +355,18 @@ std::string CopyrightHolders(const std::string& strPrefix);
355355
*/
356356
int ScheduleBatchPriority(void);
357357

358+
namespace util {
359+
360+
//! Simplification of std insertion
361+
template <typename Tdst, typename Tsrc>
362+
inline void insert(Tdst& dst, const Tsrc& src) {
363+
dst.insert(dst.begin(), src.begin(), src.end());
364+
}
365+
template <typename TsetT, typename Tsrc>
366+
inline void insert(std::set<TsetT>& dst, const Tsrc& src) {
367+
dst.insert(src.begin(), src.end());
368+
}
369+
370+
} // namespace util
371+
358372
#endif // BITCOIN_UTIL_H

0 commit comments

Comments
 (0)