From 3519961407626031997
X-Google-Thread: f78e5,ac8f7c796c0ee2eb
X-Google-Attributes: gidf78e5,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!newsfeed1.dallas1.level3.net!news.level3.com!wn13feed!worldnet.att.net!207.14.113.39!news.alt.net!comp-std-cpp-robomod!not-for-mail
From: "Jim Langston" <tazmaster@rocketmail.com>
Newsgroups: comp.std.c++
Subject: Re: std::pair istream >> operator
Date: Mon, 19 Nov 2007 12:19:02 CST
Organization: Altopia Corp. - Usenet Access - www.altopia.com
Lines: 29
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <ZtO%i.749$we4.56@newsfe02.lga>
References: <a7eb92bf-1ab8-438d-8bca-b6f7cfcc056c@o6g2000hsd.googlegroups.com>
X-Trace: pdjoodfomhkjcooblbdnpiohcfhaihogigdhaokfffhkpbfgdgbhgachkpdlnliemjomgnkeiejlbjcigcopjadkaakekfehmjjepjhfebbbakhhhagikchnlejiiiblecpcfdalnnloobep
NNTP-Posting-Date: Sat, 17 Nov 2007 20:39:37 MST
Return-Path: <devnull@stump.algebra.com>
X-Authentication-Warning: mulga.csse.unimelb.edu.au: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Original-To: std-c++@mailman.ucar.edu
Delivered-To: std-c++@mailman.ucar.edu
X-SMTP-Auth: no
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-Virus-Scanned: amavisd-new at ucar.edu
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
Xref: g2news1.google.com comp.std.c++:9647

"Andrey" <andrey_ryabov@bk.ru> wrote in message 
news:a7eb92bf-1ab8-438d-8bca-b6f7cfcc056c@o6g2000hsd.googlegroups.com...
> Hello.
> I'm wondering why there is no standard operator defined like the
> following?
>
> template<typename First, typename Second>
> istream & operator >> (istream & in, pair<First, Second> & p) {
> return in>>p.first>>p.second;
> }
>
> I always define it by hand.

Probably the same reason operator( istream& in, std::vector& p ) is not 
defined.  Or map.  Or list.  Or any of the other containers.  They are 
trivial to define and some people may wish to do them differently.  Such as 
maybe
return in >> p.second >> p.first;
or whatever.

If something is trivial to implement I don't see why it would need to be in 
the standard. 

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]



