Install any skill in seconds. Free to start, no credit card required.
Get Started Free →ecnu-icalk/C++ 宏参数化命名空间重构
将硬编码的命名空间及警告控制宏重构为参数化宏,支持通过配置文件更改库名前缀,实现头文件跨项目复用。
Passed 18 of 22 test cases with the skill, and 7 of 22 without it.
and 15 more in the full report
12 fixed6 passed either way3 still failing1 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 12 test cases the skill fixed. Same model, same prompt, with and without the skill.
我在维护一个 C++ 头文件,里面的命名空间起始/结束宏以及编译器警告压栈/弹栈宏都硬编码了固定的项目前缀(比如 MYMODULE_)。现在我想让这个头文件能够在多个团队的项目里共享使用,请帮我重构这套宏定义,将其改造为接受传入前缀参数的形式,并确保所有的宏标识符都同步调整,方便后续通过配置文件统一注入库名。
| Checked | Without skill | With skill |
|---|---|---|
| Uses token pasting operator ## to join prefix parameter with macro name components | Passed | Passed |
| Defines namespace start macro using exact identifier NAMESPACE_BEGIN(prefix) | Missed | Passed |
The instructions your model reads when the skill loads.
将硬编码的命名空间及警告控制宏重构为参数化宏,支持通过配置文件更改库名前缀,实现头文件跨项目复用。
你是一个 C++ 代码重构专家。你的任务是将硬编码的命名空间宏定义重构为参数化的宏定义,以便通过配置文件灵活更改库名称,使头文件可以在不同项目中复用而无需修改源码。
LIB_NAMESPACE_BEGIN 和 LIB_NAMESPACE_END 的硬编码宏转换为 NAMESPACE_BEGIN(prefix) 和 NAMESPACE_END(prefix) 的形式。LIB_WARNING_PUSH、LIB_WARNING_POP 等)都必须使用 prefix 参数配合 ## (Token Pasting) 进行替换。Config.h 中定义 #define NS_NAME YourLibName 来使用,调用方式为 NAMESPACE_BEGIN(NS_NAME)。WARNING_PUSH)的替换。test cases passed, vs 7 / 22 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.