среда, 5 августа 2015 г.

Шаблон с переменным количеством параметров

#include <iostream>
using namespace std;

template <class T>
void print(T t) {
    cout << t;   
}

template <class T,class... Args>
void print(T t,Args... args) {
    cout << t << " ";
    print(args...);
   
}

int main() {
   
    print(5,"333",5.2);
    return 0;
}

Комментариев нет:

Отправить комментарий