|
Boost Users : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2005-11-18 23:31:23
David Abrahams wrote:
> "Robert Ramey" <ramey_at_[hidden]> writes:
>
>> What I needed was a type that had the functioning of say an unsigned
>> integer but was of a distinguishable type. What do other people
>> mean when the say they want a strong typedef?
>
> That's roughly what they mean. But IIRC you actually needed much less
> than that, and so didn't even begin to attempt to implement all of it.
> For example, IIRC you can't add two instances of your type.
The following program DOES compile. Your probably right that I
needed less. I remember I tried to make something of wider
applicability than the serialization library. Actually, its easier
on my brain to think in terms of something more general
than think in terms of the more narrow needs of a particular
application. Its intriguing to me that no one has made a real Boost
version of something like this as I need it from time to time.
Robert Ramey
#include <boost/strong_typedef.hpp>
BOOST_STRONG_TYPEDEF(int, x_t)
main(int argc, char *argv[]){
x_t x1 = x_t(1);
x_t x2 = x_t(2);
x_t x3;
x2 = x1 + x2;
}
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net