-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cpplings] Add stl programming exercises #531
base: main
Are you sure you want to change the base?
Conversation
src/cpplings/stl.cpp
Outdated
// 1. 容器(Containers) - 用于存储数据的模板类,如vector, list, map, set等。 | ||
// - 序列容器:vector, list, deque - 以线性方式存储元素 | ||
// - 关联容器:map, set, multimap, multiset - 以键值方式存储和快速查找元素 | ||
// - 无序容器:unordered_map, unordered_set - 基于哈希表实现的快速查找 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个无序容器也是关联容器嘛?
src/cpplings/stl.cpp
Outdated
// - 输入/输出迭代器:用于单向遍历和读/写操作 | ||
// - 前向迭代器:支持多次遍历和读写操作 | ||
// - 双向迭代器:允许向前和向后遍历 | ||
// - 随机访问迭代器:支持随机访问和指针算术 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
指针算术是什么意思
src/cpplings/stl.cpp
Outdated
std::cout << std::endl; | ||
|
||
// 迭代器算术 | ||
auto iterIt = vec.begin(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
变量名统一用下划线隔开吧
src/cpplings/stl.cpp
Outdated
std::cout << "===== Algorithm Library Examples =====\n"; | ||
|
||
std::vector<int> algVec = {5, 2, 8, 1, 9, 3, 7, 4, 6}; | ||
std::vector<int> algVec2(9); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里也是
- Update container classification to correctly categorize unordered containers - Enhance random access iterator description with more detailed explanation - Standardize variable naming convention to consistent snake_case style
What problem were solved in this pull request?
Issue Number: #524
Problem:
Missing C++ stl programming exercises, affecting contributors' understanding and application of C++ STL
Need to enhance the cpplings exercise collection to support the goal of Issue #508
What is changed and how it works?
Other information
./bin/cpplings/stl