Files
modern-cpp-tutorial/code/2/2.05.structured.binding.cpp
卖码翁 e80a7120ef fix: compilation error for structured binding (#35)
The header  <tuple> is missing. After adding it, it compiles fine with clang in c++17 mode.
2018-06-13 13:51:35 +02:00

22 lines
392 B
C++

//
// 2.5.structured.binding.cpp
// chapter 2 language usability
// modern cpp tutorial
//
// created by changkun at changkun.de
//
#include <iostream>
#include <tuple>
#include <string>
std::tuple<int, double, std::string> f() {
return std::make_tuple(1, 2.3, "456");
}
int main() {
auto [x, y, z] = f();
std::cout << x << ", " << y << ", " << z << std::endl;
return 0;
}