message: Add dictionary::emplace and fix operators
diff: @@ -177,23 +177,37 @@ public:
  // -- insertion --------------------------------------------------------------
  - template <class T>
  - iterator_bool_pair insert(string_view key, T&& value) {
  + template <class K, class T>
  + iterator_bool_pair emplace(K&& key, T&& value) {
  auto i = lower_bound(key);
  if (i == end())
  - return xs_.emplace(copy(key), std::forward<T>(value));
  + return xs_.emplace(copy(std::forward<K>(key)), std::forward<T>(value));
  if (i->first == key)
  return {i, false};
  - return {xs_.emplace_hint(i, copy(key), std::forward<T>(value)), true};
  + return {xs_.emplace_hint(i, copy(std::forward<K>(key)),
  + std::forward<T>(value)),
  + true};
  }
  template <class T>
  - iterator insert(iterator hint, string_view key, T&& value) {
  + iterator_bool_pair insert(string_view key, T&& value) {
  + return emplace(key, std::forward<T>(value));
  + }
  +
  + template <class K, class T>
  + iterator emplace_hint(iterator hint, K&& key, T&& value) {
  if (hint == end() || hint->first > key)
  - return xs_.emplace(copy(key), std::forward<T>(value)).first;
  + return xs_.emplace(copy(std::forward<K>(key)), std::forward<T>(value))
  + .first;
  if (hint->first == key)
  return hint;
  - return xs_.emplace_hint(hint, copy(key), std::forward<T>(value));
  + return xs_.emplace_hint(hint, copy(std::forward<K>(key)),
  + std::forward<T>(value));
  + }
  +
  + template <class T>
  + iterator insert(iterator hint, string_view key, T&& value) {
  + return emplace_hint(hint, key, std::forward<T>(value));
  }
  template <class T>
  @@ -281,42 +295,47 @@ private:
  return std::string{str.begin(), str.end()};
  }
  + // Moves the content of `str` into a new string.
  + static inline std::string copy(std::string str) {
  + return str;
  + }
  +
  map_type xs_;
  };
  // @relates dictionary
  template <class T>
  -bool operator==(const dictionary<T>& xs, const dictionary<int>& ys) {
  +bool operator==(const dictionary<T>& xs, const dictionary<T>& ys) {
  return xs.container() == ys.container();
  }
  // @relates dictionary
  template <class T>
  -bool operator!=(const dictionary<T>& xs, const dictionary<int>& ys) {
  +bool operator!=(const dictionary<T>& xs, const dictionary<T>& ys) {
  return xs.container() != ys.container();
  }
  // @relates dictionary
  template <class T>
  -bool operator<(const dictionary<T>& xs, const dictionary<int>& ys) {
  +bool operator<(const dictionary<T>& xs, const dictionary<T>& ys) {
  return xs.container() < ys.container();
  }
  // @relates dictionary
  template <class T>
  -bool operator<=(const dictionary<T>& xs, const dictionary<int>& ys) {
  +bool operator<=(const dictionary<T>& xs, const dictionary<T>& ys) {
  return xs.container() <= ys.container();
  }
  // @relates dictionary
  template <class T>
  -bool operator>(const dictionary<T>& xs, const dictionary<int>& ys) {
  +bool operator>(const dictionary<T>& xs, const dictionary<T>& ys) {
  return xs.container() > ys.container();
  }
  // @relates dictionary
  template <class T>
  -bool operator>=(const dictionary<T>& xs, const dictionary<int>& ys) {
  +bool operator>=(const dictionary<T>& xs, const dictionary<T>& ys) {
  return xs.container() >= ys.container();
  }
  