Commit 72776069 authored by Dominik Charousset's avatar Dominik Charousset

Add free convenience function

parent 5622c8c9
...@@ -328,6 +328,8 @@ private: ...@@ -328,6 +328,8 @@ private:
map_type xs_; map_type xs_;
}; };
// -- operators ----------------------------------------------------------------
// @relates dictionary // @relates dictionary
template <class T> template <class T>
bool operator==(const dictionary<T>& xs, const dictionary<T>& ys) { bool operator==(const dictionary<T>& xs, const dictionary<T>& ys) {
...@@ -364,4 +366,13 @@ bool operator>=(const dictionary<T>& xs, const dictionary<T>& ys) { ...@@ -364,4 +366,13 @@ bool operator>=(const dictionary<T>& xs, const dictionary<T>& ys) {
return xs.container() >= ys.container(); return xs.container() >= ys.container();
} }
// -- free functions -----------------------------------------------------------
/// Convenience function for calling `dict.insert_or_assign(key, value)`.
// @relates dictionary
template <class T>
void put(dictionary<T>& dict, string_view key, T value) {
dict.insert_or_assign(key, std::move(value));
}
} // namespace caf } // namespace caf
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment