Skip to content

Commit

Permalink
utils: Add insert() convenience templates
Browse files Browse the repository at this point in the history
  • Loading branch information
kallewoof committed Jul 24, 2018
1 parent 07ce278 commit 173e18a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 173e18a

Please sign in to comment.