This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [c++0x] Ambiguity using std::to_string


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]