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

среда, 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;
}

c++

Обзор с++11 от Страуструпа: ссыль

generate(vec.begin(),vec.end(),[](){srand(clock());return rand()%10;}); remove_copy_if(vec.begin(),vec.end(),back_inserter(res),[](int i){return i>2;}); copy(vec.begin(),vec.end(),ostream_iterator<int>(cout," "));
copy(res.begin(),res.end(),ostream_iterator<int>(cout," "));