From: Kevlin Henney (kevlin_at_[hidden])
Date: 2000-11-07 15:44:09
In message <B61F28A5.387%darylew_at_[hidden]>, Daryle Walker
>I was looking at the updated "lexical_cast.hpp," and I have some questions
Sorry for only slowly getting round to this...
>1. We usually reserve the "SAME_BASE_AS_HEADER.cpp" file for mandatory
>items that the final programmer has to link in to use the header. You gave
>that name ("lexical_cast.cpp") to a test file. You should change the name,
>in case you later need an implementation file, and so new users don't assume
>to add it in and get their programs to choke (since they'll have two 'main'
Yes, this was an oversight on my part, and I noticed it recently when
pulling together diverse test files -- stood out like a sore thumb :->
>2. For "lexical_cast.hpp," it eventually needs a Boost-style header, and
>could get a Boost-like guard-#include (like 'BOOST_LEXICAL_CAST_HPP'). I
>don't think the "<new>" #include is needed any longer. (I was going to say
>the same thing for "<typeinfo>," but I remembered that 'std::bad_cast' comes
>from that header.)
Yup, agreed. History again (was originally included for std::nothrow).
>3. You could use partial specialization to make certain cases of
My concern with this is that there are too many special cases, a
potentially unbounded list. However, I think this may be a suitable
approach for something that Dave Abrahams mentioned in passing at the
Toronto mtg, and is mentioned briefly in the future directions section
of the lexical_cast documentation: an interpret_cast that makes
appropriate dispatch decisions (eg lexical_cast vs numeric_cast) and
provides appropriate specialisations (as you have outlined).
Kevlin Henney phone: +44 117 942 2990
Curbralan Limited mobile: +44 7801 073 508
mailto:kevlin_at_[hidden] fax: +44 870 052 2289
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk