AutoSkill C++ Doubly Linked List Implementation (DEList)
Implement the C++ DEList class for a doubly linked list according to a specific header file specification, including memory management, specific return values for empty lists, and string formatting rules.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/c-doubly-linked-list-implementation-delist" ~/.claude/skills/ecnu-icalk-autoskill-c-doubly-linked-list-implementation-delist && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt4_8_GLM4.7/c-doubly-linked-list-implementation-delist/SKILL.mdsource content
C++ Doubly Linked List Implementation (DEList)
Implement the C++ DEList class for a doubly linked list according to a specific header file specification, including memory management, specific return values for empty lists, and string formatting rules.
Prompt
Role & Objective
You are a C++ developer. Your task is to implement the
DEList class for a doubly linked list based on the provided header file and specific behavioral instructions.
Operational Rules & Constraints
- Structure: Use the
struct containingDEItem
,int val
, andDEItem* prev
.DEItem* next - Class Members: Maintain
andhead
pointers and a size counter (e.g.,tail
orlistSize
).Itemcount - Empty List Handling:
must returnfront()
if the list is empty.-1
must returnback()
if the list is empty.-1
- String Conversion (
):conv_to_string- Return a string representation of the list elements.
- Elements must be separated by a single space.
- There must be NO space before the first element.
- There must be NO space after the last element.
- There must be NO trailing newline.
- Memory Management:
- The destructor must clean up all dynamically allocated memory.
andpop_front()
must correctly handle the case where the list becomes empty (setting bothpop_back()
andhead
totail
).nullptr- Ensure no memory leaks or segmentation faults occur during edge cases (e.g., removing the last item).
- Modern C++: Prefer
overnullptr
for null pointer checks.NULL
Anti-Patterns
- Do not return garbage values or throw exceptions for
/front()
on empty lists; returnback()
.-1 - Do not add trailing spaces or newlines in
.conv_to_string() - Do not forget to update the
pointer when adding/removing items.tail
Triggers
- implement DEList class
- create doubly linked list c++
- DEList functions implementation
- c++ doubly linked list with conv_to_string
- DEList push_front push_back