From 4856388933116655276
X-Google-Thread: f78e5,c4a7f0fb4ab1315a
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news4.google.com!news.glorb.com!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!lnewsinpeer00.lnd.ops.eu.uu.net!emea.uu.net!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: Sylvain.Pion@sophia.inria.fr (Sylvain Pion)
Newsgroups: comp.std.c++
Subject: Possible ambiguity in parsing complex depending on locale ?
Date: Thu, 22 Mar 2007 15:12:47 GMT
Organization: INRIA - Unite de Recherche Sophia Antipolis (France)
Lines: 37
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <ettn4q$67o$1@news-sop.inria.fr>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.demon.co.uk 1174576436 25397 158.152.254.254 (22 Mar 2007 15:13:56 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Thu, 22 Mar 2007 15:13:56 +0000 (UTC)
X-Original-To: std-c++@mailman.ucar.edu
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: Thunderbird 1.5.0.10 (X11/20070301)
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
X-Received: (from fjh@localhost)
	by mulga.csse.unimelb.edu.au (8.13.8+Sun/8.13.8/Submit) id l2MFCld4014268;
	Fri, 23 Mar 2007 02:12:47 +1100 (EST)
X-Path: comp-std-cpp-robomod!not-for-mail
X-Delivered-To: std-c++@mailman.ucar.edu
X-Authentication-Warning: mulga.csse.unimelb.edu.au: fjh set sender to devnull@stump.algebra.com using -f
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (sophia.inria.fr [138.96.64.20]); Thu, 22 Mar 2007 11:53:22 +0100 (MET)
X-Newsgroups: comp.std.c++
Xref: g2news1.google.com comp.std.c++:8173

Hi,

I am wondering if there can be an ambiguity in parsing std::complex
from a stream, depending on the locale.  The standard says:

template<class T, class charT, class traits>
basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is , complex<T>& x );

Effects: Extracts a complex number x of the form: u, (u), or (u,v), 
where u is the real part and v is the imaginary part.


Now, what happens if the decimal point is a comma, following the locale?
In that case, "(1,2)" could be parsed in 2 different ways, in practice
ending up with the complex number being the real number 1.2 instead
of (1,2).

I am not very familiar with how locales work, so I don't know if they
can affect this stream operator.


The context of this question is that I have the same issue for the
std::interval proposal (N2137), where intervals can be read as [u]
or [u,v].

Thanks for any answer and advice.

-- 
Sylvain

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



