|
Boost : |
From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2002-07-24 16:31:56
On Wed, 24 Jul 2002 03:43:31 +0200, Terje Slettebø
<tslettebo_at_[hidden]> wrote:
>>From: "Gennaro Prota" <gennaro_prota_at_[hidden]>
>
>By the way, there's a question to Gennadiy in this posting, as well.
>
Well, if the question is the same for both, the syntax is:
ask /to genna* <your_question> ;-)
Seriously, I've looked at the new version and I find it very nice.
Only two points:
1) About pointer_to_char_base: maybe someone will argue whether
something like
template<class Target, class Source>
struct pointer_to_char_base
{
static Target do_cast(Source arg)
{
return arg[0];
}
};
isn't preferable.
In any case, the current implementation triggers undefined behavior
with empty source strings; a trivial fix is:
template<class Target, class Source>
struct pointer_to_char_base
{
static Target do_cast(Source arg)
{
Target t = arg[0];
if(t != 0 && arg[1] != 0)
throw bad_lexical_cast();
return t;
}
};
2) Stupid question of the day: is there any reason why all Source
function parameters cannot be declared as Source const &?
P.S.: Does anyone know if Intel C++ 6.0 for Windows can properly
support wchar_t as a distinct type? I've also experimented with the
new /Zc:wchar_t switch. Well, if you try the following:
#include <iostream>
void dummy (unsigned short par) {
std::cout << "wrong overload... - ";
std::cout << par;
}
void dummy (wchar_t par) {
std::wcout << L"wchar_t! - ";
std::wcout << par;
}
int main() {
dummy (L'1');
}
it (correctly) compiles only with the switch, but (incorrectly) prints
"wrong overload... - 49"! :-(
Genny.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk