mardi 25 octobre 2016

Are implicit conversions allowed with std::tie?

In c++11, are implicit conversions allowed with std::tie?

The following code compiles and runs but I'm not sure exactly what's going on behind the scenes or if this is safe.

std::tuple<float,float> foo() { return std::make_tuple(0,0); }

double a, b;
std::tie(a,b) = foo(); // a and b are doubles but foo() returns floats

Aucun commentaire:

Enregistrer un commentaire