vendredi 24 juillet 2020

std::make_tuple and rvalue reference

Like below, why "vv" here is not an rvalue-reference? Here the type of "v" is rvalue-reference, and according to the inference rule of decltype, the decltype of an rvalue-reference (not a prvalue) should be the type of rvalue-reference, right?

int main(int argc, char **argv) {
  int x{};
  const auto [v] = std::make_tuple<int&&>(std::move(x));  // v -> const int &&;
  decltype(v) vv = 10;  // vv -> const int;
  return 0;
}

Aucun commentaire:

Enregistrer un commentaire