Boost logo

Boost Users :

From: Wolfgang Meyer (Wolfgang.Meyer_at_[hidden])
Date: 2004-05-28 18:38:15


On Friday 28 May 2004 20:43, Caleb Epstein wrote:

> typedef variant<int, double, string> elem_t;
>
> int main ()
> {
> elem_t pi = M_PI;
> double d = get (pi);

If my understanding is correct, "get" expects the desired result type to be
specified explicitly. In fact, how should the compiler deduce the return type
of "get" otherwise? So you need to write:

double d = get<double>(pi);

Regards,
  Wolfgang Meyer


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