Boost logo

Boost Users :

Subject: Re: [Boost-users] [uuid] to string problem
From: John Dlugosz (JDlugosz_at_[hidden])
Date: 2010-05-12 14:29:18



>
> Argument-dependent look-up, but I'm sure that's not on dictionary.com
> :)

I'll add it to Wiktionary, but can't remember my password.

>
> No, the important semantic difference is that lexical_cast<string> can
> not use ADL. However, it could be a good idea to write a generic
> lexical_cast<string> that resolves to a unqualified call to to_string.

Ah, to make the explicit specialization you would have to close the normal namespaces and open up the namespace for its primary template.

But wait! It's not a specialization, it's an overloading. The template argument is for the result type. The parameter is overloaded in the normal way, and subject to normal resolution.

to_string (const C& x)
to_wstring (const C& x)
to_xstring (const C& x)
to_MFC_CString (const C& x)
... etc?

to_string<std::wstring>(x);
specifies the return type (which can default to std::string) and is defined in the same namespace as C.

If you called it lexical_cast instead, are you saying that would not play nicely with the existing lexical_cast definitions?

--John




TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net