0
votes

I'm using boost::intrusive lib to create a class with two lists (one intrusive::list and one intrusive::slist) using the same node (w two hooks), as described below.

    using cache_hook = list_base_hook<>;
    using time_hook = slist_base_hook<>;

    struct cache_node : public cache_hook, public time_hook{...}

    using evic_list = list<cache_node>;
    using evic_iterator = typename evic_list::iterator;

    using timeout_list = slist<cache_node>;
    using timeout_iterator = typename timeout_list::iterator;

Now, I want to iterate through evic_list, and then when a certain node is found (using a custom predicate) I want to erase this node from the two lists.

class double_list
{
    inline void erase(evic_iterator<Key> &iter)
    {
        m_list.erase(iter);
        tout_list.erase(iter);
    }
    private:
        evic_list m_list;
        timeout_list tout_list;
};

The problem is that "tout_list.erase(iter);" should take a timeout_iterator as parameter, but "iter" is a evic_iterator. Since they both point to the same object, how could I convert evic_iterator to timeout_iterator ?

https://github.com/bellirodrigo2/cahier