Is there a similar way to read integer pairs from stdin to vector<pair<int,int> > in C++ -
i wondering if there way slick following
copy(istream_iterator<int>(cin), istream_iterator<int>(),back_inserter(v));
to copy pairs of int
vector<pair<int,int> >
when input given in pairs in order of appearance?
thanks.
you can – need write own operator >>
pair class first. operator whole secret of above call. actual implementation depends on format of int pairs.
Comments
Post a Comment