Fixed MergeByKey so that it can take references.

This commit is contained in:
Pedro Pinto committed 2018-01-29 08:51:23 -05:00
1 parent 0882966138
commit cf8a79201d
2 files changed
+5 -3

No files matched your search

@@ -8,7 +8,10 @@ namespace mercury {
template <class EV> class MergeByKey : public ISynopsisBuilder {
public:
using Key = decltype(((EV *)nullptr)->key());
using RefConstKey = decltype(((EV *)nullptr)->key());
using ConstKey = typename std::remove_reference<RefConstKey>::type;
using Key = typename std::remove_const<ConstKey>::type;
using TMap = std::unordered_map<Key, EV>;
MergeByKey() : _synopsis(), _empty(), _dirty() { clear_synopsis(); }
@@ -15,8 +15,7 @@ public:
using SynopsisPolicy = mercury::MergeByKey<StoredFillEvent>;
StoredFillEvent(api::orderman2::Fill &fill) : fill(&fill) {}
auto key() const {return fill->fill_key();}
std::string const& key() const {return fill->fill_key();}
api::orderman2::Fill *fill;
};