From -5731116759170720152
X-Google-Thread: f78e5,c4a7f0fb4ab1315a,start
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.speakeasy.net!news.speakeasy.net.POSTED!not-for-mail
NNTP-Posting-Date: Thu, 22 Mar 2007 09:50:04 -0500
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
From: Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
Newsgroups: comp.std.c++
Subject: Possible ambiguity in parsing complex depending on locale ?
Organization: INRIA - Unite de Recherche Sophia Antipolis (France)
Message-ID: <ettnao$680$1@news-sop.inria.fr>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@sophia.inria.fr
User-Agent: Thunderbird 1.5.0.10 (X11/20070301)
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:55:20 +0100 (MET)
X-Virus-Scanned: by amavisd-new at sophia.inria.fr
X-Virus-Scanned: amavisd-new at ucar.edu
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
Date: Thu, 22 Mar 2007 09:46:35 CST
Lines: 37
NNTP-Posting-Host: 65.182.171.162
X-Trace: sv3-Ic6rgTTDn20pv8bG5eA8DFsrIICsSAk6c7Ge+qFUU3P4kA2HtAcCd6fVWXBA9ofgHLEdmMYW5SGfqD5!Pub/PFuzoZTxBoaJ1pSuT/7s229I4Hu4TDpIplpoVV7fyWLRYwi6ToTYWZjVklDRuPCoAX3Vk2Ds!u1b0/MWV+NjO
X-Complaints-To: abuse@speakeasy.net
X-DMCA-Complaints-To: abuse@speakeasy.net
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.34
Xref: g2news1.google.com comp.std.c++:8170

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                      ]



