Adar Dembo has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/11303 )

Change subject: error_manager: rename error types
......................................................................


Patch Set 4:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/11303/4/src/kudu/gutil/map-util.h
File src/kudu/gutil/map-util.h:

http://gerrit.cloudera.org:8080/#/c/11303/4/src/kudu/gutil/map-util.h@457
PS4, Line 457:   typedef typename Collection::mapped_type mapped_type;
             :   auto it = collection->find(key);
             :   if (it == collection->end()) {
             :     collection->emplace(key, std::forward<mapped_type>(value));
             :     return true;
             :   }
             :   it->second = std::forward<mapped_type>(value);
             :   return false;
Why isn't this implemented more like InsertOrUpdate? Like:

  std::pair<typename Collection::iterator, bool> ret = 
collection->emplace(std::forward<Args>(args)...);
  if (!ret.second) {
    // update
    ret.first->second = ...
    return false;
  }
  return true;

I guess for this to work the function signature has to take the variadic rvalue 
reference form. I struggled with the ... but I presume if no insert occurred, 
you could forward 'args' again.



--
To view, visit http://gerrit.cloudera.org:8080/11303
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I377904ee51bb0f7b0f1104d7a4723f74d52e6e3f
Gerrit-Change-Number: 11303
Gerrit-PatchSet: 4
Gerrit-Owner: Andrew Wong <aw...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <a...@cloudera.com>
Gerrit-Reviewer: Andrew Wong <aw...@cloudera.com>
Gerrit-Reviewer: Grant Henke <granthe...@apache.org>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Tidy Bot
Gerrit-Comment-Date: Mon, 27 Aug 2018 22:18:26 +0000
Gerrit-HasComments: Yes

Reply via email to