tinycodinglm / cpp /cppstd001.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 15)
b27bfb3 verified
|
Raw History Blame Contribute Delete
1.94 kB
{"type": "session", "harness": "deepseek-harness", "id": "cppstd001", "name": "C++ standard library overview"}
{"type": "message", "message": {"role": "system", "content": "You are an expert software engineer and technical assistant. You provide accurate, detailed, and practical answers. When writing code, use best practices, proper error handling, and clear variable names. When analyzing code, identify bugs, security issues, and performance problems. You have deep knowledge of C/C++, Windows API, Python, and many other technologies."}}
{"type": "message", "message": {"role": "user", "content": "What are the key C++ standard library features?"}}
{"type": "message", "message": {"role": "assistant", "content": "```cpp\n// Containers\n#include <vector>\n#include <map>\n#include <set>\n#include <unordered_map>\n#include <array>\n#include <deque>\n#include <list>\n\nstd::vector<int> v = {1, 2, 3};\nv.push_back(4);\nv.emplace_back(5);\nauto& ref = v[0];\n\nstd::map<std::string, int> m = {{\"a\", 1}};\nm[\"b\"] = 2;\nauto it = m.find(\"a\");\n\nstd::unordered_map<std::string, int> um; // O(1) lookup\n\n// Algorithms\n#include <algorithm>\n#include <numeric>\n\nstd::sort(v.begin(), v.end());\nstd::sort(v.begin(), v.end(), std::greater<int>());\nauto it = std::find(v.begin(), v.end(), 3);\nint sum = std::accumulate(v.begin(), v.end(), 0);\nstd::reverse(v.begin(), v.end());\nauto [min_it, max_it] = std::minmax_element(v.begin(), v.end());\n\n// Smart pointers\n#include <memory>\nauto up = std::make_unique<int>(42);\nauto sp = std::make_shared<int>(42);\nstd::weak_ptr<int> wp = sp;\n\n// String\n#include <string>\nstd::string s = \"hello\";\ns.substr(0, 3);\ns.find(\"ell\");\nauto parts = s | std::views::split(' ');\n\n// Optional/Variant/Any (C++17)\n#include <optional>\n#include <variant>\n#include <any>\nstd::optional<int> opt = 42;\nstd::variant<int, std::string> var = \"hello\";\nstd::any a = 42;\n```"}}