fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <type_traits>
  4. using namespace std;
  5.  
  6. void process_letter_location(char c, string const& str)
  7. {
  8. cout << str << '\n';
  9. }
  10.  
  11. void process_strings(char* buf, string const& str)
  12. {
  13. process_letter_location(*buf, str);
  14. }
  15.  
  16. template<typename... Args>
  17. auto process_strings(char* buf, string const& str, Args... args)
  18. -> typename enable_if<sizeof...(Args)>::type
  19. {
  20. process_letter_location(*buf, str);
  21. process_strings (++buf, args...);
  22. }
  23.  
  24.  
  25. int main() {
  26. string sf_1 = "something1",
  27. sf_2 = "something2",
  28. sf_3 = "something3",
  29. sf_4 = "something4";
  30.  
  31. char buff[10];
  32. process_strings(buff, sf_1, sf_2, sf_3, sf_4);
  33. return 0;
  34. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
something1
something2
something3
something4