|
Boost : |
From: Andrey Semashev (andysem_at_[hidden])
Date: 2007-05-09 05:49:48
Hello Mathias,
Wednesday, May 9, 2007, 4:20:29 AM, you wrote:
> Andrey Semashev wrote:
>> It could be a "strong typedef":
> It could, but it isn't.
> Remember that int8_t etc. are from C.
> By the way, if they were, there could be a more or less serious
> performance hit depending on the implementation.
> Structures/classes are not handled the same way as primitive types in
> most ABIs for example I think. Which is quite a shame, by the way.
Modern compilers produce almost the same binaries with such light
classes as they were fundamental types. But you're right about ABI.
This would surely affect mangling, for example.
Another solution is to add a wrapper that would be recognized by
lexical_cast:
int8_t n = lexical_cast< as_int< int8_t > >("127");
At least lexical_cast could encapsulate range checking during
conversion.
-- 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