summaryrefslogtreecommitdiff
path: root/asl/containers
diff options
context:
space:
mode:
authorSteven Le Rouzic <steven.lerouzic@gmail.com>2025-03-06 22:56:56 +0100
committerSteven Le Rouzic <steven.lerouzic@gmail.com>2025-03-06 22:56:56 +0100
commitf0cccbe3285c039553e1fd8b5a5c7830d6087974 (patch)
tree57a0902484ec5c8ba3b9a8e7089ed42f58b6a580 /asl/containers
parent54affafd86e2b7f387345c08e8c7285c775d75e5 (diff)
Replace ASL_MOVE, ASL_FWD, and ASL_FWD_LIKE by their std:: equivalent
This is because some compiler stuff and diagnostics tools rely on those symboles being what they are.
Diffstat (limited to 'asl/containers')
-rw-r--r--asl/containers/buffer.hpp24
-rw-r--r--asl/containers/buffer_tests.cpp16
-rw-r--r--asl/containers/hash_map.hpp10
-rw-r--r--asl/containers/hash_set.hpp12
-rw-r--r--asl/containers/hash_set_tests.cpp4
-rw-r--r--asl/containers/intrusive_list.hpp4
6 files changed, 35 insertions, 35 deletions
diff --git a/asl/containers/buffer.hpp b/asl/containers/buffer.hpp
index 8bdb63e..386b52a 100644
--- a/asl/containers/buffer.hpp
+++ b/asl/containers/buffer.hpp
@@ -170,7 +170,7 @@ private:
if (assign)
{
- m_allocator = ASL_MOVE(other.m_allocator);
+ m_allocator = std::move(other.m_allocator);
}
}
@@ -209,7 +209,7 @@ private:
// NOLINTNEXTLINE(*-pointer-arithmetic)
for (T* it = data_ptr + old_size; it < end; ++it)
{
- construct_at<T>(it, ASL_FWD(args)...);
+ construct_at<T>(it, std::forward<Args>(args)...);
}
}
@@ -224,11 +224,11 @@ public:
}
explicit constexpr buffer(Allocator allocator)
- : m_allocator{ASL_MOVE(allocator)}
+ : m_allocator{std::move(allocator)}
{}
explicit constexpr buffer(span<const T> s, Allocator allocator)
- : m_allocator{ASL_MOVE(allocator)}
+ : m_allocator{std::move(allocator)}
{
copy_range(s);
}
@@ -242,9 +242,9 @@ public:
constexpr buffer(buffer&& other)
requires moveable<T>
- : buffer(ASL_MOVE(other.m_allocator))
+ : buffer(std::move(other.m_allocator))
{
- move_from_other(ASL_MOVE(other), false);
+ move_from_other(std::move(other), false);
}
constexpr buffer& operator=(const buffer& other)
@@ -259,7 +259,7 @@ public:
requires moveable<T>
{
if (&other == this) { return *this; }
- move_from_other(ASL_MOVE(other), true);
+ move_from_other(std::move(other), true);
return *this;
}
@@ -381,7 +381,7 @@ public:
requires constructible_from<T, decltype(args)&&...>
{
T* uninit = push_uninit();
- T* init = construct_at<T>(uninit, ASL_FWD(args)...);
+ T* init = construct_at<T>(uninit, std::forward<decltype(args)>(args)...);
return *init;
}
@@ -410,12 +410,12 @@ public:
return contiguous_iterator<type>{self.data() + self.size()};
}
- constexpr operator span<const T>() const // NOLINT(*-explicit-conversions)
+ constexpr operator span<const T>() const // NOLINT(*explicit*)
{
return as_span();
}
- constexpr operator span<T>() // NOLINT(*-explicit-conversions)
+ constexpr operator span<T>() // NOLINT(*explicit*)
{
return as_span();
}
@@ -429,14 +429,14 @@ public:
constexpr auto&& operator[](this auto&& self, isize_t i)
{
ASL_ASSERT(i >= 0 && i <= self.size());
- return ASL_FWD_LIKE(decltype(self), ASL_FWD(self).data()[i]);
+ return std::forward_like<decltype(self)>(std::forward<decltype(self)>(self).data()[i]);
}
template<typename H>
requires hashable<T>
friend H AslHashValue(H h, const buffer& b)
{
- return H::combine_contiguous(ASL_MOVE(h), b.as_span());
+ return H::combine_contiguous(std::move(h), b.as_span());
}
};
diff --git a/asl/containers/buffer_tests.cpp b/asl/containers/buffer_tests.cpp
index 23fe5af..af79c92 100644
--- a/asl/containers/buffer_tests.cpp
+++ b/asl/containers/buffer_tests.cpp
@@ -275,7 +275,7 @@ ASL_TEST(move_construct_from_heap)
buf.push(&d[2]);
{
- asl::buffer<DestructorObserver> buf2(ASL_MOVE(buf));
+ asl::buffer<DestructorObserver> buf2(std::move(buf));
ASL_TEST_EXPECT(buf2.size() == 3);
ASL_TEST_EXPECT(d[0] == false);
ASL_TEST_EXPECT(d[1] == false);
@@ -294,7 +294,7 @@ ASL_TEST(move_construct_inline_trivial)
buf.push(1U);
buf.push(2U);
- asl::buffer<uint64_t> buf2(ASL_MOVE(buf));
+ asl::buffer<uint64_t> buf2(std::move(buf));
ASL_TEST_EXPECT(buf2[0] == 1U);
ASL_TEST_EXPECT(buf2[1] == 2U);
@@ -310,7 +310,7 @@ ASL_TEST(move_construct_from_inline_non_trivial)
buf.push(&d[1]);
{
- asl::buffer<DestructorObserver> buf2(ASL_MOVE(buf));
+ asl::buffer<DestructorObserver> buf2(std::move(buf));
ASL_TEST_EXPECT(buf2.size() == 2);
ASL_TEST_EXPECT(d[0] == false);
ASL_TEST_EXPECT(d[1] == false);
@@ -344,7 +344,7 @@ ASL_TEST(move_assign_from_heap)
ASL_TEST_EXPECT(d[4] == false);
ASL_TEST_EXPECT(d[5] == false);
- buf2 = ASL_MOVE(buf);
+ buf2 = std::move(buf);
ASL_TEST_EXPECT(buf.size() == 0);
ASL_TEST_EXPECT(buf2.size() == 3);
@@ -380,7 +380,7 @@ ASL_TEST(move_assign_trivial_heap_to_inline)
buf2.push(5);
ASL_TEST_EXPECT(alloc_count == 1);
- buf = ASL_MOVE(buf2);
+ buf = std::move(buf2);
ASL_TEST_EXPECT(alloc_count == 1);
ASL_TEST_EXPECT(buf.size() == 3);
@@ -405,7 +405,7 @@ ASL_TEST(move_assign_trivial_inline_to_heap)
buf2.push(5);
ASL_TEST_EXPECT(alloc_count == 1);
- buf2 = ASL_MOVE(buf);
+ buf2 = std::move(buf);
ASL_TEST_EXPECT(alloc_count == 1);
ASL_TEST_EXPECT(buf.size() == 0);
@@ -430,7 +430,7 @@ ASL_TEST(move_assign_inline_to_heap)
buf2.push(&d[4]);
buf2.push(&d[5]);
- buf2 = ASL_MOVE(buf);
+ buf2 = std::move(buf);
ASL_TEST_EXPECT(buf.size() == 0);
ASL_TEST_EXPECT(buf2.size() == 2);
@@ -466,7 +466,7 @@ ASL_TEST(move_assign_from_inline_incompatible_allocator)
buf2.push(&d[4]);
buf2.push(&d[5]);
- buf2 = ASL_MOVE(buf);
+ buf2 = std::move(buf);
ASL_TEST_EXPECT(buf.size() == 0);
ASL_TEST_EXPECT(buf2.size() == 2);
diff --git a/asl/containers/hash_map.hpp b/asl/containers/hash_map.hpp
index 77e5512..cf2f0b2 100644
--- a/asl/containers/hash_map.hpp
+++ b/asl/containers/hash_map.hpp
@@ -77,7 +77,7 @@ public:
constexpr hash_map() requires default_constructible<Allocator> = default;
explicit constexpr hash_map(Allocator allocator)
- : Base{ASL_MOVE(allocator)}
+ : Base{std::move(allocator)}
{}
hash_map(const hash_map&) requires copyable<K> && copyable<V> = default;
@@ -122,7 +122,7 @@ public:
{
ASL_ASSERT((Base::m_tags[result.first_available_index] & Base::kHasValue) == 0);
- Base::m_values[result.first_available_index].construct_unsafe(ASL_MOVE(Base::m_values[result.already_present_index].as_init_unsafe()));
+ Base::m_values[result.first_available_index].construct_unsafe(std::move(Base::m_values[result.already_present_index].as_init_unsafe()));
Base::m_values[result.already_present_index].destroy_unsafe();
Base::m_tags[result.first_available_index] = result.tag;
@@ -133,17 +133,17 @@ public:
if constexpr (sizeof...(Args1) == 0 && assignable_from<V&, Arg0&&>)
{
- Base::m_values[result.first_available_index].as_init_unsafe().value = ASL_FWD(arg0);
+ Base::m_values[result.first_available_index].as_init_unsafe().value = std::forward<Arg0>(arg0);
}
else
{
- Base::m_values[result.first_available_index].as_init_unsafe().value = ASL_MOVE(V{ASL_FWD(arg0), ASL_FWD(args1)...});
+ Base::m_values[result.first_available_index].as_init_unsafe().value = std::move(V{std::forward<Arg0>(arg0), std::forward<Args1>(args1)...});
}
}
else
{
ASL_ASSERT((Base::m_tags[result.first_available_index] & Base::kHasValue) == 0);
- Base::m_values[result.first_available_index].construct_unsafe(ASL_FWD(key), V{ASL_FWD(arg0), ASL_FWD(args1)...});
+ Base::m_values[result.first_available_index].construct_unsafe(std::forward<U>(key), V{std::forward<Arg0>(arg0), std::forward<Args1>(args1)...});
Base::m_tags[result.first_available_index] = result.tag;
Base::m_size += 1;
}
diff --git a/asl/containers/hash_set.hpp b/asl/containers/hash_set.hpp
index 6c46aac..61346fa 100644
--- a/asl/containers/hash_set.hpp
+++ b/asl/containers/hash_set.hpp
@@ -115,7 +115,7 @@ protected:
*size += 1;
}
- values[result.first_available_index].construct_unsafe(ASL_MOVE(value));
+ values[result.first_available_index].construct_unsafe(std::move(value));
tags[result.first_available_index] = result.tag;
}
@@ -144,7 +144,7 @@ protected:
{
if ((m_tags[i] & kHasValue) == 0) { continue; }
- insert_inner(ASL_MOVE(m_values[i].as_init_unsafe()), new_tags, new_values, new_capacity, &new_size);
+ insert_inner(std::move(m_values[i].as_init_unsafe()), new_tags, new_values, new_capacity, &new_size);
// Destroy now so that destroy() has less things to do
m_values[i].destroy_unsafe();
@@ -312,7 +312,7 @@ public:
{}
explicit constexpr hash_set(Allocator allocator)
- : m_allocator{ASL_MOVE(allocator)}
+ : m_allocator{std::move(allocator)}
{}
hash_set(const hash_set& other)
@@ -339,7 +339,7 @@ public:
, m_values{exchange(other.m_values, nullptr)}
, m_capacity{exchange(other.m_capacity, 0)}
, m_size{exchange(other.m_size, 0)}
- , m_allocator{ASL_MOVE(other.m_allocator)}
+ , m_allocator{std::move(other.m_allocator)}
{}
hash_set& operator=(hash_set&& other)
@@ -351,7 +351,7 @@ public:
m_values = exchange(other.m_values, nullptr);
m_capacity = exchange(other.m_capacity, 0);
m_size = exchange(other.m_size, 0);
- m_allocator = ASL_MOVE(other.m_allocator);
+ m_allocator = std::move(other.m_allocator);
}
return *this;
}
@@ -393,7 +393,7 @@ public:
{
maybe_grow_to_fit_one_more();
ASL_ASSERT(m_size < max_size());
- insert_inner(ASL_MOVE(T{ASL_FWD(args)...}), m_tags, m_values, m_capacity, &m_size);
+ insert_inner(T{std::forward<Args>(args)...}, m_tags, m_values, m_capacity, &m_size);
}
template<typename U>
diff --git a/asl/containers/hash_set_tests.cpp b/asl/containers/hash_set_tests.cpp
index d9462d5..515fe76 100644
--- a/asl/containers/hash_set_tests.cpp
+++ b/asl/containers/hash_set_tests.cpp
@@ -170,7 +170,7 @@ ASL_TEST(move)
set1.insert(i);
}
- asl::hash_set<int> set2 = ASL_MOVE(set1);
+ asl::hash_set<int> set2 = std::move(set1);
ASL_TEST_EXPECT(set2.size() == 100);
for (int i = 0; i < 100; ++i)
@@ -178,7 +178,7 @@ ASL_TEST(move)
ASL_TEST_EXPECT(set2.contains(i));
}
- set1 = ASL_MOVE(set2);
+ set1 = std::move(set2);
ASL_TEST_EXPECT(set1.size() == 100);
for (int i = 0; i < 100; ++i)
diff --git a/asl/containers/intrusive_list.hpp b/asl/containers/intrusive_list.hpp
index fc911ec..2af02eb 100644
--- a/asl/containers/intrusive_list.hpp
+++ b/asl/containers/intrusive_list.hpp
@@ -43,8 +43,8 @@ public:
push_front(head);
}
- ASL_DELETE_COPY(IntrusiveList)
- ASL_DEFAULT_MOVE(IntrusiveList)
+ ASL_DELETE_COPY(IntrusiveList);
+ ASL_DEFAULT_MOVE(IntrusiveList);
~IntrusiveList() = default;
constexpr bool is_empty() const { return m_head == nullptr; }