summaryrefslogtreecommitdiff
path: root/asl
diff options
context:
space:
mode:
authorSteven Le Rouzic <steven.lerouzic@gmail.com>2025-03-03 23:53:14 +0100
committerSteven Le Rouzic <steven.lerouzic@gmail.com>2025-03-03 23:53:14 +0100
commit54affafd86e2b7f387345c08e8c7285c775d75e5 (patch)
tree93f88e854b6bc3a69e4a411cf44a39de3cf1d861 /asl
parent8604c98df53486208cdc15424aae9d9b2fef2d8e (diff)
Rename intrusive_list head & tail to front & backv0.1.0
Diffstat (limited to 'asl')
-rw-r--r--asl/containers/intrusive_list.hpp8
-rw-r--r--asl/containers/intrusive_list_tests.cpp28
2 files changed, 18 insertions, 18 deletions
diff --git a/asl/containers/intrusive_list.hpp b/asl/containers/intrusive_list.hpp
index ce0c133..fc911ec 100644
--- a/asl/containers/intrusive_list.hpp
+++ b/asl/containers/intrusive_list.hpp
@@ -80,13 +80,13 @@ public:
}
}
- constexpr auto head(this auto&& self)
+ constexpr auto front(this auto&& self)
{
using return_type = un_ref_t<copy_cref_t<decltype(self), T>>*;
return return_type{ self.m_head };
}
- constexpr auto tail(this auto&& self)
+ constexpr auto back(this auto&& self)
{
using return_type = un_ref_t<copy_cref_t<decltype(self), T>>*;
return return_type{ self.m_head != nullptr ? self.m_head->m_prev : nullptr };
@@ -178,13 +178,13 @@ public:
auto begin(this auto&& self)
{
using iterator_type = select_t<is_const<un_ref_t<decltype(self)>>, const_iterator, iterator>;
- return iterator_type{ self.head(), self.is_empty() };
+ return iterator_type{ self.front(), self.is_empty() };
}
auto end(this auto&& self)
{
using iterator_type = select_t<is_const<un_ref_t<decltype(self)>>, const_iterator, iterator>;
- return iterator_type{ self.head(), true };
+ return iterator_type{ self.front(), true };
}
};
diff --git a/asl/containers/intrusive_list_tests.cpp b/asl/containers/intrusive_list_tests.cpp
index 5d2d97b..4e19237 100644
--- a/asl/containers/intrusive_list_tests.cpp
+++ b/asl/containers/intrusive_list_tests.cpp
@@ -19,8 +19,8 @@ ASL_TEST(empty_list)
{
const asl::IntrusiveList<IntNode> list;
ASL_TEST_EXPECT(list.is_empty());
- ASL_TEST_EXPECT(list.head() == nullptr);
- ASL_TEST_EXPECT(list.tail() == nullptr);
+ ASL_TEST_EXPECT(list.front() == nullptr);
+ ASL_TEST_EXPECT(list.back() == nullptr);
}
ASL_TEST(push_front)
@@ -32,8 +32,8 @@ ASL_TEST(push_front)
list.push_front(&one);
ASL_TEST_EXPECT(!list.is_empty());
- ASL_TEST_EXPECT(list.head() == &one);
- ASL_TEST_EXPECT(list.tail() == &one);
+ ASL_TEST_EXPECT(list.front() == &one);
+ ASL_TEST_EXPECT(list.back() == &one);
auto it = list.begin();
auto end = list.end();
@@ -44,8 +44,8 @@ ASL_TEST(push_front)
ASL_TEST_ASSERT(it == end);
list.push_front(&two);
- ASL_TEST_EXPECT(list.head() == &two);
- ASL_TEST_EXPECT(list.tail() == &one);
+ ASL_TEST_EXPECT(list.front() == &two);
+ ASL_TEST_EXPECT(list.back() == &one);
it = list.begin();
end = list.end();
@@ -58,8 +58,8 @@ ASL_TEST(push_front)
ASL_TEST_ASSERT(it == end);
list.push_front(&three);
- ASL_TEST_EXPECT(list.head() == &three);
- ASL_TEST_EXPECT(list.tail() == &one);
+ ASL_TEST_EXPECT(list.front() == &three);
+ ASL_TEST_EXPECT(list.back() == &one);
it = list.begin();
end = list.end();
@@ -84,8 +84,8 @@ ASL_TEST(push_back)
list.push_back(&one);
ASL_TEST_EXPECT(!list.is_empty());
- ASL_TEST_EXPECT(list.head() == &one);
- ASL_TEST_EXPECT(list.tail() == &one);
+ ASL_TEST_EXPECT(list.front() == &one);
+ ASL_TEST_EXPECT(list.back() == &one);
auto it = list.begin();
auto end = list.end();
@@ -96,8 +96,8 @@ ASL_TEST(push_back)
ASL_TEST_ASSERT(it == end);
list.push_back(&two);
- ASL_TEST_EXPECT(list.head() == &one);
- ASL_TEST_EXPECT(list.tail() == &two);
+ ASL_TEST_EXPECT(list.front() == &one);
+ ASL_TEST_EXPECT(list.back() == &two);
it = list.begin();
end = list.end();
@@ -110,8 +110,8 @@ ASL_TEST(push_back)
ASL_TEST_ASSERT(it == end);
list.push_back(&three);
- ASL_TEST_EXPECT(list.head() == &one);
- ASL_TEST_EXPECT(list.tail() == &three);
+ ASL_TEST_EXPECT(list.front() == &one);
+ ASL_TEST_EXPECT(list.back() == &three);
it = list.begin();
end = list.end();