fork(2) download
  1. #include <functional>
  2. #include <iostream>
  3. #include <string>
  4. #include <tuple>
  5. using namespace std;
  6.  
  7. template <size_t begin = 0U, typename... Tp>
  8. enable_if_t<begin == sizeof...(Tp), void> foo(tuple<Tp...>& t){
  9. cout << endl;
  10. }
  11.  
  12. template <size_t begin = 0U, typename... Tp>
  13. enable_if_t<begin < sizeof...(Tp), void> foo(tuple<Tp...>& t) {
  14. cout << get<begin>(t);
  15. foo<begin + 1, Tp...>(t);
  16. }
  17.  
  18. int main() {
  19. tuple<int, string, float> t = make_tuple(42, "Jonathan Mee", 13.13);
  20.  
  21. foo(t);
  22. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
42Jonathan Mee13.13