Boost logo

Boost Users :

From: Aaron Griffin (aaronmgriffin_at_[hidden])
Date: 2005-10-25 13:55:58


This isn't a full blown issue really, but it's probably a lack of
understanding on my part.

variant<
   typeA,
   typeB,
   int,
   double> v;

gives me conversion ambiguities. I can remove the int and it works
fine. In an attempt to kludge it, I changed the int to a
rational<int>. However, now, "v = 12" is converted to a double, not
to the rational.

First question, would be, how exactly is the variant choosing to use
the double instead of the rational? Does it have anything to do with
order? Would <double,rational<int> > be different compared to
<rational<int>,double> ?

Is there any way to "slay" this ambiguity. It's a rather moot point,
but I'd like to know if it's an int or a double, seperately, not one
single double which would require me to determine if it is a whole
number or not.

Thanks in advance,
Aaron


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