Archived
This forum has been archived. Please start a new discussion on GitHub.
desing question about dictionaries

xdm
La Coruña, Spain
in Help Center
Hi Zeroc
In the latest version of ice-programing book Ice-2.0.0
in slice maping section. I read that dictionaries can't not
use floating points values as key type.
I'm developing a PriceService with it's main target is to
maintaing diferent price list for a catalog of products that's
implementing in a diferent Ice service.
I want that my PriceService can index the Prices but my price
is defined as a double and like double values can't no be the key
type of dictionaries i need other aproach to solve this trouble
Now re reding Ice progrmaing book i see that struct of basic types can
can be used as key type of dictionaries and i think that i can
change my price type fron double to a struct like this
Can any body say me if this is a good aproach or if there are
any better soluttion for this trouble?
thanks to all you
and congratulations Zeroc team for Ice-2.0.0
In the latest version of ice-programing book Ice-2.0.0
in slice maping section. I read that dictionaries can't not
use floating points values as key type.
I'm developing a PriceService with it's main target is to
maintaing diferent price list for a catalog of products that's
implementing in a diferent Ice service.
I want that my PriceService can index the Prices but my price
is defined as a double and like double values can't no be the key
type of dictionaries i need other aproach to solve this trouble
Now re reding Ice progrmaing book i see that struct of basic types can
can be used as key type of dictionaries and i think that i can
change my price type fron double to a struct like this
struct PriceValue { long integerPart; long fractionPart; }; dictionary <PriceValue,ProductPrice>PriceValueMap;
Can any body say me if this is a good aproach or if there are
any better soluttion for this trouble?
thanks to all you
and congratulations Zeroc team for Ice-2.0.0
0