You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

04-type-inference-decltype.cc 215 B

1234567891011
  1. #include <iostream>
  2. int main() {
  3. auto x = 1;
  4. auto y = 2.0;
  5. decltype(x+y) z;
  6. if (std::is_same<decltype(x+y), double>::value) {
  7. std::cout << "x+y is double" << std::endl;
  8. }
  9. return 0;
  10. }