based

Opinionated utility library
git clone git://git.dimitrijedobrota.com/based.git
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING

commit 5d77a74c63b3ff6af2945c707ab6b30a104bee77
parent e05518366f95774a67b4cae361fa9bc02edf3eb5
author Dimitrije Dobrota < mail@dimitrijedobrota.com >
date Fri, 4 Apr 2025 14:01:34 +0200

Use pointer instead of std::reference_wrapper

Diffstat:
M include/based/list.hpp | ++++++ ------

1 files changed, 6 insertions(+), 6 deletions(-)


diff --git a/ include/based/list.hpp b/ include/based/list.hpp

@@ -20,7 +20,7 @@ public:

private:
struct node_t
{
value_type value;
value_type value {};
list_type next = list_type(0);
};

@@ -67,17 +67,17 @@ public:

}

iterator(list_pool& pool, list_pool::list_type node)
: m_pool(pool)
: m_pool(&pool)
, m_node(node)
{
}

reference operator*() const { return m_pool.get().value(m_node); }
reference operator*() const { return m_pool->value(m_node); }
pointer operator->() const { return &**this; }

iterator& operator++()
{
m_node = m_pool.get().next(m_node);
m_node = m_pool->next(m_node);
return *this;
}

@@ -90,7 +90,7 @@ public:


friend bool operator==(const iterator& x, const iterator& y)
{
// assert(x.m_pool == y.m_pool);
assert(x.m_pool == y.m_pool);
return x.m_node == y.m_node;
}

@@ -100,7 +100,7 @@ public:

}

private:
std::reference_wrapper<list_pool> m_pool;
list_pool* m_pool;
list_pool::list_type m_node;
};