This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [c++0x] Ambiguity using std::to_string
- From: Christopher Jefferson <chris at bubblescope dot net>
- To: Germán Diago <germandiago at gmail dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Tue, 10 Nov 2009 08:30:50 +0000
- Subject: Re: [c++0x] Ambiguity using std::to_string
- References: <b798010f0911100024j7d509756x39f2ac3eab5236de@mail.gmail.com>
On 10 Nov 2009, at 08:24, Germán Diago wrote:
> Hello. I've been using std::to_string and I don't know if it's a bug,
> but it's usability is horrible because:
>
> int year;
>
> std::to_string(year);
>
> causes an ambiguity between long long double, long long int and long
> long double.
>
> So the way to avoid this is:
>
> to_string((long long)year);
>
> Shouldn't this be a better match for long long int? Because this way
> of using it annoys me quite a bit and
> it makes it unconfortable to use:
>
> Maybe there should be an overload for every type including int, long
> int, unsigned int, double, long double and float.
> Would this prevent ambiguities?
I agree with you. I think this is a case of someone trying to be too clever, and not realising that the set of overloads they specified was not enough.
>
> I looked at the draft c++ standard (the last one available (N2960) )
> and it does not include anything apart of
> long long int and long long double.
>
> Thanks.