Boost logo

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;

  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

Best regards,
 Andrey                            mailto:andysem_at_[hidden]

Boost list run by bdawes at, gregod at, cpdaniel at, john at