exercism / exercism/cpp

New Exercise Idea: Template parameter packs

未关闭
#501 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C++
星标
290
派生
244
PR 合并指标
30 天内没有已合并 PR

描述

With the new v3 concepts I though it would be good to focus more on C++ specific ideas which aren't currently covered in the exercises. Here's some example solution code for the exercise:

```
#include
#include

// Should be able to take in any length/ type of arguements
template std::string concat(Args... args)
{
std::stringstream output;
((output << std::forward(args) << ","), ...);
return output.str();
}

int main() {
std::cout << concat(123, "test") << std::endl;
// Prints: "123, test,"
return 0;
}
```

Wanted to run this by other people before I went and created a whole exercise around it.

Also FYI the "Please see the contributing guide" in the README is a broken link.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。