
28 Sep
2004
28 Sep
'04
1:51 p.m.
Maxim Yegorushkin wrote:
Vladimir Prus <ghost@cs.msu.su> wrote:
Maxim Yegorushkin wrote:
In generic code lexical_cast<> is sometimes used as a cast to the same type. I would like to shortcut this rather then going all the way by writing it to a stream and reading back.
Do you mean you sometimes use lexical_cast to cast between two types, neither of which is std::string?
Rather both of them are. Do you still need an example?
No. But in that case, I'm not sure it's good to use disable_if. According to tests, lexical_cast is much more portable than enable_if/disable_if and you don't need the generic lexical_cast<T>(T) case, only the string case. I really wonder if somebody ever used lexical cast to convert between two non-string types? - Volodya