|
Boost : |
From: Andrey Semashev (andysem_at_[hidden])
Date: 2007-05-08 16:24:18
Hello Mathias,
Tuesday, May 8, 2007, 11:10:11 PM, you wrote:
> Dean Michael Berris wrote:
>> I still think the
>> semantics of `lexical_cast<int8_t>("127")` should allow for the
>> conversion to happen -- either convert to a 'short int' then assign to
>> a char, if that makes any sense.
> There is no way to distinguish int8_t and char. They are both aliases to
> the same type.
> Welcome to the wonderful world of typedefs.
It could be a "strong typedef":
class int8_t
{
char value;
public:
int8_t() {}
int8_t(int8_t const& that) : value(that.value) {}
int8_t(char that) : value(that) {}
// etc. all applicable operators and traits
};
But I guess this would eventually break something more critical than
lexical_cast.
-- Best regards, Andrey mailto:andysem_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk