|
Download cpp/cpp-modules-cpp20.jsonl from winapiadmin/tinycodinglm: direct link, hf CLI and curl.
- Browser
- Download file 1.78 kB
-
https://huggingface.co/datasets/winapiadmin/tinycodinglm/resolve/b5bf3ebebe22b46f4f78c2589a5bb814a44293a7/cpp/cpp-modules-cpp20.jsonl
- Command line
-
hf download hf://datasets/winapiadmin/tinycodinglm@b5bf3ebebe22b46f4f78c2589a5bb814a44293a7/cpp/cpp-modules-cpp20.jsonl
-
curl -L -o cpp-modules-cpp20.jsonl https://huggingface.co/datasets/winapiadmin/tinycodinglm/resolve/b5bf3ebebe22b46f4f78c2589a5bb814a44293a7/cpp/cpp-modules-cpp20.jsonl
1.78 kB
| {"type": "session", "harness": "opencode", "id": "cpp-modules-cpp20", "name": "Use C++20 modules for faster compilation and better encapsulation"} | |
| {"type": "message", "message": {"role": "system", "content": "You are an expert C++ developer. You write clean, efficient, and idiomatic code."}} | |
| {"type": "message", "message": {"role": "user", "content": "Use C++20 modules for faster compilation and better encapsulation"}} | |
| {"type": "message", "message": {"role": "assistant", "content": "// Module interface (math.cppm)\n// export module math;\n//\n// export namespace math {\n// int add(int a, int b) { return a + b; }\n// int multiply(int a, int b) { return a * b; }\n// }\n\n// Module usage (main.cpp)\n// import math;\n// int main() {\n// return math::add(1, 2);\n// }\n\n// Header units example\n// import <iostream>;\n// import <vector>;\n// import <string>;\n\n// Below shows the module interface pattern\n#include <iostream>\n#include <vector>\n#include <string>\n\n// Simulated module interface\nexport module example;\n\nexport namespace example {\n int add(int a, int b) { return a + b; }\n\n class Calculator {\n public:\n int add(int a, int b) const { return a + b; }\n int subtract(int a, int b) const { return a - b; }\n double divide(double a, double b) const { return a / b; }\n };\n}\n\n// Module partition\nexport module example:utils;\n\nexport namespace example::utils {\n std::string toUpper(const std::string& s) {\n std::string result = s;\n for (auto& c : result) c = toupper(c);\n return result;\n }\n}\n\nint main() {\n example::Calculator calc;\n std::cout << calc.add(3, 4) << \"\\n\";\n std::cout << example::utils::toUpper(\"hello\") << \"\\n\";\n return 0;\n}"}} | |