exercism / exercism/cpp

New Exercise Idea: Template parameter packs

Đang mở
#501 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C++
Star
290
Fork
244
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.