Allow specification of comparator in MRUCache |
||
Issue descriptionThe MRUCache class (https://cs.chromium.org/chromium/src/base/containers/mru_cache.h?cl=GROK&gsn=CERT_POLICY_COMPLIES_VIA_SCTS&q=mrucache&sq=package:chromium&l=213) takes as template parameters the KeyType and PayloadType. It specifies the default comparator, std::less<KeyType> to its superclass, MRUCacheBase. That means user-defined types cannot be used in the MRUCache unless std::less is specialized for them in the global namespace (as far as I understand). This is preventing me from using directly the object I want in the MRUCache (SHA256HashValue), forcing me to convert it to a string.
,
Nov 29 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/b36da9dffc6fed50a8d72d1818d5a574e6502940 commit b36da9dffc6fed50a8d72d1818d5a574e6502940 Author: rsleevi <rsleevi@chromium.org> Date: Tue Nov 29 02:56:31 2016 Allow custom comparators for the MRUCache //base's MRUCache allowed specifying key and value types, like an underlying std::map<>, but the default base::MRUCache explicitly specialized the comparator as std::less<>. Rather than require the caller to overload std::less<> or operator<, allow the comparator to be specified as a templated argument. BUG= 665735 Review-Url: https://codereview.chromium.org/2532313002 Cr-Commit-Position: refs/heads/master@{#434850} [modify] https://crrev.com/b36da9dffc6fed50a8d72d1818d5a574e6502940/base/containers/mru_cache.h
,
Dec 14 2016
|
||
►
Sign in to add a comment |
||
Comment 1 by ajha@chromium.org
, Nov 18 2016