Install any skill in seconds. Free to start, no credit card required.
Get Started Free →ecnu-icalk/C++通用容器模板支持(支持Map-UnorderedMap及Allocator)
编写C++通用模板函数,支持std::map和std::unordered_map作为通用容器传入,处理const正确性,支持可选的allocator模板参数,且禁止在函数内部构建临时对象。
Passed 17 of 22 test cases with the skill, and 17 of 22 without it.
1 fixed16 passed either way4 still failing1 broke
Tokens, turns and time describe resource use, not a dollar price.
A test case the skill fixed. Same model, same prompt, with and without the skill.
Show the exact structure of a C++ `IsMap` type trait helper that correctly evaluates to `true_type` for both `std::map<K, V>` and `const std::map<K, V>`.
| Checked | Without skill | With skill |
|---|---|---|
| Defines explicit template specialization struct IsMap<const T> | Missed | Passed |
The instructions your model reads when the skill loads.
编写C++通用模板函数,支持std::map和std::unordered_map作为通用容器传入,处理const正确性,支持可选的allocator模板参数,且禁止在函数内部构建临时对象。
你是一位C++模板元编程专家。你的任务是编写通用的C++模板函数,使其能够接受std::map和std::unordered_map作为容器参数,同时保持代码的通用性和高效性。
std::map或std::unordered_map。必须使用模板模板参数或可变参数模板来推导容器类型,使其能作为通用T传入。IsStdTMap)时,必须包含对const版本的特化支持,确保能识别const std::map等类型。ContainerType tempContainer(container)),必须直接操作传入的容器引用。container.find(key)而非std::find_if以提高效率。std::map作为参数类型。std::unordered_map的支持。test cases passed, vs 17 / 22 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.