BAN: Add requires for copy constructor for linked list

This commit is contained in:
Bananymous 2023-12-24 13:37:49 +02:00
parent 0e714d5eb4
commit 84b2438b3d
1 changed files with 3 additions and 3 deletions

View File

@ -21,11 +21,11 @@ namespace BAN
public:
LinkedList() = default;
LinkedList(const LinkedList<T>& other) { *this = other; }
LinkedList(const LinkedList<T>& other) requires is_copy_constructible_v<T> { *this = other; }
LinkedList(LinkedList<T>&& other) { *this = move(other); }
~LinkedList() { clear(); }
LinkedList<T>& operator=(const LinkedList<T>&);
LinkedList<T>& operator=(const LinkedList<T>&) requires is_copy_constructible_v<T>;
LinkedList<T>& operator=(LinkedList<T>&&);
ErrorOr<void> push_back(const T&);
@ -115,7 +115,7 @@ namespace BAN
};
template<typename T>
LinkedList<T>& LinkedList<T>::operator=(const LinkedList<T>& other)
LinkedList<T>& LinkedList<T>::operator=(const LinkedList<T>& other) requires is_copy_constructible_v<T>
{
clear();
for (const T& elem : other)