
On Wed, Feb 18, 2009 at 2:27 PM, Andrey Semashev <andrey.semashev@gmail.com> wrote:
Emil Dotchevski wrote:
On Wed, Feb 18, 2009 at 1:44 PM, Andrey Semashev <andrey.semashev@gmail.com> wrote:
Emil Dotchevski wrote: I assume there can be connection with other Boost libraries, like Boost.NumericConversion or Boost.Units. This library has potential to become a common framework for conversion facilities that are reimplemented here and there quite often. And I feel that a common and well recognizable interface is very important for such a framework. That is, I think it would be better to use a common name for conversions in either direction (well, the direction doesn't matter anyway, from perspective of such a framework).
Agreed.
The disagreement seems to be about the relationship between such conversion library and to- and from- string conversions.
IMO, from the viewpoint of convert(), to- and from- string conversions should be treated as independent interface, much like Boost.NumericConversion or Boost.Units, etc.
Why?
For the same reason Boost.NumericConversion and Boost.Units are independent. You're not proposing to make Boost.NumericConversion and Boost.Units also parts of the convert() library, are you? Why do you want to do this for the to- and from-string conversions?
(Though as it is evident, you'll still have hard time convincing me that when all I need is to convert a foo to std::string, I have to use "the mother of all conversions" library instead of the straight forward to_string.)
Perhaps. I still don't understand why would you want to use specific functions, like to_string/to_wstring/to_whatever_string(foo) instead of a unified interface function convert< whatever >(foo).
The answer is the same as why I don't always use templates. I use templates when I need my code to be generic, otherwise I do not. If I want to convert to T I'll use convert<T> if I want to convert to string, I prefer the much lighter s=to_string(x). Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode