RecentEntries: Don't reference Entry template arg directly.

This commit is contained in:
Jared Boone 2016-09-03 12:58:11 -07:00
parent c6f7d7f844
commit 4d781df76c

View File

@ -37,13 +37,13 @@ template<class Packet, class Entry>
class RecentEntries { class RecentEntries {
public: public:
using EntryType = Entry; using EntryType = Entry;
using Key = typename Entry::Key; using Key = typename EntryType::Key;
using ContainerType = std::list<Entry>; using ContainerType = std::list<EntryType>;
using const_reference = typename ContainerType::const_reference; using const_reference = typename ContainerType::const_reference;
using const_iterator = typename ContainerType::const_iterator; using const_iterator = typename ContainerType::const_iterator;
using RangeType = std::pair<const_iterator, const_iterator>; using RangeType = std::pair<const_iterator, const_iterator>;
const Entry& on_packet(const Key key, const Packet& packet) { const EntryType& on_packet(const Key key, const Packet& packet) {
auto matching_recent = find(key); auto matching_recent = find(key);
if( matching_recent != std::end(entries) ) { if( matching_recent != std::end(entries) ) {
// Found within. Move to front of list, increment counter. // Found within. Move to front of list, increment counter.
@ -67,7 +67,7 @@ public:
const_iterator find(const Key key) const { const_iterator find(const Key key) const {
return std::find_if( return std::find_if(
std::begin(entries), std::end(entries), std::begin(entries), std::end(entries),
[key](const Entry& e) { return e.key() == key; } [key](const EntryType& e) { return e.key() == key; }
); );
} }