Skip to content

Commit

Permalink
Updates linked list. Not complete.
Browse files Browse the repository at this point in the history
  • Loading branch information
ax-6 committed Mar 28, 2024
1 parent c40386d commit 8199344
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 41 deletions.
2 changes: 1 addition & 1 deletion compiler/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Compiler {
struct Pair;
template <typename ValueType>
class HashMap;
template <typename ValueType>
template <typename DataType>
class LinkedList;
template <typename ArrayType>
class DynArray;
Expand Down
2 changes: 1 addition & 1 deletion compiler/linked_list/linked_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ template <typename ValueType>
Compiler::LinkedList<ValueType>::LinkedList()=default;
template <typename ValueType>
Compiler::LinkedList<ValueType>::~LinkedList(){
Clear();

};
}
54 changes: 15 additions & 39 deletions compiler/linked_list/linked_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,57 +12,33 @@

namespace Aq {

template <typename ValueType>
template <typename DataType>
class Compiler::LinkedList {
public:
struct Node {
Pair<Node*, Node*> location;
ValueType data;
};

LinkedList();
~LinkedList();

/*
LinkedList(const LinkedList&) = delete;
LinkedList(LinkedList&&) noexcept = delete;
LinkedList& operator=(const LinkedList&) = delete;
LinkedList& operator=(LinkedList&&) noexcept = delete;

LinkedList& operator=(const LinkedList& other);

allocator_type GetAllocator() const;
ValueType* Front();
const ValueType* Front() const;
ValueType* Back();
const ValueType* Back() const;
iterator Begin();
const_iterator Begin() const;
iterator End();
const_iterator End() const;
bool Empty() const;
size_type Size() const;
void Clear();
iterator Insert(iterator pos, const ValueType& value);
template <class... Args>
iterator Emplace(iterator pos, Args&&... args);
iterator Erase(iterator pos);
void PushFront(const ValueType& value);
void PushBack(const ValueType& value);
void PopFront();
void PopBack();
void Merge(MyList& other);
void Splice(iterator pos, MyList& other, iterator first, iterator last);
void Remove(const ValueType& value);
template <class UnaryPredicate>
void RemoveIf(UnaryPredicate pred);
void Reverse();
void Unique();
template <class Compare>
void Sort(Compare comp);
*/
struct Node {
Pair<Node*, Node*> location;
DataType data;
};

void Insert(Node* prev_node, DataType new_data);

// Wait development.
void Remove(Node* delete_node);

private:
Node* head_;
Node* tail_;
};

} // namespace Aq

#endif // AQ_COMPILER_LINKED_LIST_LINKED_LIST_H_
#endif

0 comments on commit 8199344

Please sign in to comment.