Специализни шаблонца! (udpn) wrote,
Специализни шаблонца!

Туда и обратно

#include <iostream>
#include <vector>
#include <string>
#include <iterator>
#include <algorithm>
using namespace std;

template <typename T> istream & operator >> (istream & i, back_insert_iterator<T> & b) {
    typename T::value_type x; if (i >> x) b = x; return i;

int main() {
    vector<string> w; while (cin >> *back_inserter(w));
    copy(begin(w), end(w), ostream_iterator<string>(cout, " "));
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 1 comment