Boost logo

Boost :

From: Dale E. Strickler (DaleS_at_[hidden])
Date: 2001-12-19 15:39:27


><cut...>
>This is just off the top of my head. And of course, you'd want to make sure
>you'd cover all the valid operators. From that point, all you have to do is
>create dummy classes that represent your partitioning of semantic space.

Yes, I have come up with (not implemented) this long hand approach as
well. I was hoping that:
A. Someone though of a smarter way to reuse the operators defined for int's
in the semantic type.
B. Someone had a well tested template that filling in all the pieces so
that I could just build the dummy classes.

-Dale

>For best results, it would be preferable to replace the "const T&"
>parameters with the types identified by the boost call traits library. I
>haven't used explicit much, and the documentation I've seen hasn't indicated
>that the operator T can be marked as such, but I vaguely remember that being
>the case. Unfortunately, most of my books are currently in storage.
>
>
>-- Noah
>
>
> > -----Original Message-----
> > From: Dale E. Strickler [mailto:DaleS_at_[hidden]]
> > Sent: Wednesday, December 19, 2001 10:40 AM
> > To: boost_at_[hidden]
> > Subject: [boost] Looking for 'real' typedef.
> >
> >
> > I have been searching through the boots library and have not yet
> > found what
> > I was looking for so I thought I would post a brief note to see
> > if there is
> > something in the works of if someone has a reference that might help.
> >
> > I would like to have variables that act like intrinsic types int
> > and double
> > but which are type unique in signatures. For instance I would like to do
> > the following:
> >
> > some_sort_of_typedef<int> Apples_t;
> > some_sort_of_typedef<int> Oranges_t;
> >
> > class cFruitMangager
> > {
> > public:
> > // ....some constructors and such
> > AppleFun(Apples_t a){ // do stuff with apples just like ints.};
> > OrangeFun(Oranges_t o){ // do stuff with oranges just
> > like ints. };
> >
> > // .. more stuff
> > }
> >
> > void main(void)
> > {
> > cFruitMangager MyManager;
> > Apple_t aApple;
> > Orange_t aOrange;
> >
> > MyManager.AppleFun(aApple); // Ok!
> > MyManager.AppleFun(aOrange); // Won't compile type
> > mismatch.
> >
> > // also
> > Orange_t newOrange=aOrange * 2 // ok!
> > newOrange= aOrange + 1.03 // ok BUT does int math.
> >
> > Apple_t newApple=aApple + aOrange; // Won't compile type
> > mismatch.
> >
> > newApple=aApple * 2 // ok!
> > newApple= aOrange + 1.03 // ok BUT does int math.
> > }
> >
> > Any ideas?
> >
> >
> > Best Regards,
> >
> > Dale E. Strickler
> > President and Sr. Consultant
> > ___________________________________
> > ___________________________________
> > DES Software Engineering Consulting
> > E-mail: DaleS_at_[hidden]
> > Voice: 434-846-7003 (NOTE New area code!)
> > FAX: 434-846-7040 (NOTE New area code!)
> > Web: www.dessec.com
> >
> >
> >
> > Info: http://www.boost.org Send unsubscribe requests to:
> > <mailto:boost-unsubscribe_at_[hidden]>
> >
> > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
> >
> >
> >
>
>
>Info: http://www.boost.org Send unsubscribe requests to:
><mailto:boost-unsubscribe_at_[hidden]>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

Best Regards,

Dale E. Strickler
President and Sr. Consultant
___________________________________
___________________________________
DES Software Engineering Consulting
E-mail: DaleS_at_[hidden]
  Voice: 434-846-7003 (NOTE New area code!)
    FAX: 434-846-7040 (NOTE New area code!)
    Web: www.dessec.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk