From -114713102986984684
X-Google-Thread: f78e5,e1d72e3830635ee,start
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news1.google.com!newsfeed.gamma.ru!Gamma.RU!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!t-online.de!peer-uk.news.demon.net!kibo.news.demon.net!mutlu.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: no.spam@no.spam.com (Maciej Sobczak)
Newsgroups: comp.std.c++
Subject: std::tolower - which one should be visible?
Date: Fri, 22 Jul 2005 15:42:30 GMT
Organization: CERN - European Laboratory for Particle Physics
Lines: 37
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <dbqg7i$fa2$1@sunnews.cern.ch>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.demon.co.uk 1122046959 14667 158.152.254.254 (22 Jul 2005 15:42:39 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Fri, 22 Jul 2005 15:42:39 +0000 (UTC)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050524 Red Hat/1.7.8-1.1.3.1
X-Accept-Language: en-us, en
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id j6MFgUxD024535;
	Sat, 23 Jul 2005 01:42:30 +1000 (EST)
X-Path: comp-std-cpp-robomod!not-for-mail
X-Delivered-To: std-c++@ucar.edu
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Newsgroups: comp.std.c++
Xref: g2news1.google.com comp.std.c++:1458

Hello,

#include <string>
#include <algorithm>
#include <cctype>

// later:

string a, b;
// ...
transform(a.begin(), a.end(), b.begin(), std::tolower);

Taking into account what was #included, the std::tolower should name a 
single-parameter function from the standard C library, so that the above 
code should work.

On the other hand, the <locale> header is allowed to be *implicitly* 
included (for example by <string>), meaning that std::tolower could 
possibly name also the two-parameter version that is locale-aware, 
rendering the above ambiguous and ill-formed.

Is this considered to be a problem?

It can be solved by casting to the requested function type, but the 
issue is whether the above code is *guaranteed* to work or not.


-- 
Maciej Sobczak : http://www.msobczak.com/
Programming    : http://www.msobczak.com/prog/

---
[ 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.jamesd.demon.co.uk/csc/faq.html                       ]



