mirror of
https://github.com/changkun/modern-cpp-tutorial.git
synced 2025-12-17 12:44:40 +03:00
revision #1: 更新第二章中已维护的代码
This commit is contained in:
20
code/2/2.5.structured.binding.cpp
Normal file
20
code/2/2.5.structured.binding.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// 2.5.structured.binding.cpp
|
||||
// chapter 2 language usability
|
||||
// modern cpp tutorial
|
||||
//
|
||||
// created by changkun at changkun.de
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user