|
Boost : |
From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2003-03-26 15:25:07
>From: "David Abrahams" <dave_at_[hidden]>
> "Rozental, Gennadiy" <gennadiy.rozental_at_[hidden]> writes:
>
> >> Even if none of the above looks sound for you I still argue that
> >> lexical_cast *should not force* inclusion of typeinfo. It's not
> >> "inconvinience" - it's showstopper. It's much more important
> >> than providing
> >> specific type info. In majority of the cases one knows it anyway.
> >>
> >> > Kevlin
> >>
> >> Gennadiy.
> >
> > So. Are we gonna stuck with typeinfo in lexical_cast?
> >
> > Could we have at least some discussion about this?
>
> My contribution to the discussion is that I don't think supporting C++
> language subsets is worth complicating the interface in the way you
> propose. Maybe lexical_cast<T*>(whatever) should return 0 on failure
> and that should be enough for those who can't handle the exceptions we
> want to throw... though I don't know how (or if) that interacts with
> things like char const*.
Technically, this should be possible, since it now throws an exception if
you try to convert to any pointer, as it checks for that. This is to remove
the possibility of trying to convert to char *, which could otherwise
succeed (due to the design of basic_istream), but would give undefined
behaviour.
Regards,
Terje
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk