exercism / exercism/cpp

New Exercise Idea: Template parameter packs

Offen
#501 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C++
Sterne
290
Forks
244
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.