From 4365330632310200883
X-Google-Thread: f78e5,ac8f7c796c0ee2eb
X-Google-Attributes: gidf78e5,public,usenet
X-Google-Language: ENGLISH,ASCII
Path: g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Tue, 20 Nov 2007 17:30:04 -0600
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
From: James Kanze <james.kanze@gmail.com>
Newsgroups: comp.std.c++
Subject: Re: std::pair istream >> operator
Organization: http://groups.google.com
Message-ID: <d2c27769-782e-4bb5-bf34-9923a94dc86d@b15g2000hsa.googlegroups.com>
References: <a7eb92bf-1ab8-438d-8bca-b6f7cfcc056c@o6g2000hsd.googlegroups.com> 
	<ZtO%i.749$we4.56@newsfe02.lga>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Complaints-To: groups-abuse@google.com
Complaints-To: groups-abuse@google.com
Injection-Info: b15g2000hsa.googlegroups.com; posting-host=86.70.189.110; 
	posting-account=1W_PtwoAAAA1QoMcl2Z5P6j-DNc8HR3W
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.6) 
	Gecko/20070725 Firefox/2.0.0.6,gzip(gfe),gzip(gfe)
Content-Disposition: inline
X-Virus-Scanned: amavisd-new at ucar.edu
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by mulga.csse.unimelb.edu.au id lAKMW6qb022416
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
Date: Tue, 20 Nov 2007 17:27:11 CST
Lines: 44
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-on1+sftOA4SgbnLbx9br/V3RzueDaNksAzFW6rJC/vukJKMfvEecAA3M1Dgk3kEb5FKEyHk4uVgvaWS!MzgNudgtauUwvatxz++CUWtAcznfWY9kU3rBa6K954md8ja9uyngwc0RYmrfhf9T7yqDitGmvsZs!BVH6vwMKVy0Bb3puutGAPcGOxHw=
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.36
Xref: g2news1.google.com comp.std.c++:9661

On Nov 19, 7:19 pm, "Jim Langston" <tazmas...@rocketmail.com> wrote:
> "Andrey" <andrey_rya...@bk.ru> wrote in message

> news:a7eb92bf-1ab8-438d-8bca-b6f7cfcc056c@o6g2000hsd.googlegroups.com...

> > 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

Are they?  Write a definition of std::pair<double,double> that
will work when invoked by the std::ostream_iterator of the type?

Perhaps the biggest argument for defining them in the standard
is that for built-in types, they must be defined in std::, which
is something a user isn't allowed to do.

Of course, the argument only holds water if you believe that
they should be overloaded.  Given that the types in question
have no semantics, and no real "standard" format, there should
probably never be an << or a >> for such types in a program,
neither in the standard nor in user code.

--
James Kanze (GABI Software)             email:james.kanze@gmail.com
Conseils en informatique orient�e objet/
                   Beratung in objektorientierter Datenverarbeitung
9 place S�mard, 78210 St.-Cyr-l'�cole, France, +33 (0)1 30 23 00 34

---
[ 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                      ]



