> On May 4, 2015, 6:46 p.m., Alexander Rojas wrote: > > I am not really sure this is the way to go in order to create a case > > insensite hashmap. The class `hashmap` simply adds functionality to the > > `boost::unordered_map`. If one checks the API for the latter, the way > > needed to create an insensitive hashmap is to override the template > > parameters `Hash` and `Pred`. So I think it would be better simply to > > expose them in hashmap changin `stout/hashmpa.hpp` to: > > > > ```cpp > > template <typename Key, typename Value, typename Hash = boost::hash<Key>, > > typename Pred = std::equal_to<Key>> > > class hashmap : public boost::unoredered_map<Key, Value, Hash, Pred> > > { > > … > > }; > > ``` > > > > The you only need to define functors that provide insensitive operatiosn > > for `Hash` and `Pred` and finally a typedef. > > Ben Mahler wrote: > Another approach here is to define a type for the key which captures what > we want ('CaseInsensitiveString'), this lets us capture it in the type > signature cleanly: hashmap<CaseInsensitiveString, string>. > > But, in line with what Alex wrote, and from my > [comment](https://issues.apache.org/jira/browse/MESOS-328?focusedCommentId=14526217&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14526217) > in MESOS-328, I'd suggest one of the following: > > (1) Use unordered_map with custom equality and hash in http::Request / > http::Response (we have c++11 now so can assume the presence of > std::unordered_map). > (2) Extend hashmap to support custom equality and hash, and use this in > http::Request / http::Response.
@arojas @bmahler I update the patch and I choose exterd hashmap to support custom equality and hash. But I am not sure where should I add the InsensitiveHash and InsensitiveEqual now. I put them in http.hpp now, you could check it out from another [review](https://reviews.apache.org/r/33793/diff/#). By the way, I not sure whether I should add a typedef or not. And If I want add a typedef, should I add it to http.hpp or hashmap.hpp? - haosdent ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/33792/#review82415 ----------------------------------------------------------- On May 9, 2015, 3:04 p.m., haosdent huang wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/33792/ > ----------------------------------------------------------- > > (Updated May 9, 2015, 3:04 p.m.) > > > Review request for mesos, Alexander Rojas and Ben Mahler. > > > Bugs: MESOS-328 > https://issues.apache.org/jira/browse/MESOS-328 > > > Repository: mesos > > > Description > ------- > > Add InsensitiveHashMap. > > > Diffs > ----- > > 3rdparty/libprocess/3rdparty/stout/include/stout/hashmap.hpp > 24dc369ec271ec2f35449e6ccf49c5b829ca6ce8 > 3rdparty/libprocess/3rdparty/stout/tests/hashmap_tests.cpp > e8a932e5474bf2ba1a93a945ff9bc61fb5146c02 > > Diff: https://reviews.apache.org/r/33792/diff/ > > > Testing > ------- > > make check > > > Thanks, > > haosdent huang > >