Add operator<< for std::map

This is to allow chaining inserts and to avoid temporary variables when inserting maps returned from functions.
This commit is contained in:
Allan Odgaard
2013-05-09 22:40:35 +07:00
parent 92192341d4
commit 58cfa20a1b

View File

@@ -57,4 +57,11 @@ namespace oak
}
};
template <typename _SrcKeyT, typename _SrcValueT, typename _DstKeyT, typename _DstValueT>
std::map<_SrcKeyT, _SrcValueT>& operator<< (std::map<_DstKeyT, _DstValueT>& dst, std::map<_SrcKeyT, _SrcValueT> const& src)
{
dst.insert(src.begin(), src.end());
return dst;
}
#endif /* end of include guard: OAK_ALGORITHM_H_E3HYH9S3 */