Boost logo

Boost Users :

From: Aaron Griffin (aaronmgriffin_at_[hidden])
Date: 2005-10-25 16:27:07


Correction to the below:
It is not int and double causing the problems (I have about 6-7 types
in here), it is, in fact int and bool. The question still stands, but
with different types.
However, I guess it wouldn't be all that difficult to just use 1 and 0.

On 10/25/05, Aaron Griffin <aaronmgriffin_at_[hidden]> wrote:
> 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