![Page 1: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/1.jpg)
Effective Modern C++ StudyC++ Korea
![Page 2: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/2.jpg)
![Page 3: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/3.jpg)
Effective Modern C++ StudyC++ Korea3
![Page 4: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/4.jpg)
Effective Modern C++ StudyC++ Korea4
![Page 5: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/5.jpg)
Effective Modern C++ StudyC++ Korea5
![Page 6: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/6.jpg)
Effective Modern C++ StudyC++ Korea6
constexpr auto tenMillion = 10000000;constexpr auto tenMillion = 10’000’000;
//in C++14
![Page 7: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/7.jpg)
Effective Modern C++ StudyC++ Korea7
![Page 8: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/8.jpg)
Effective Modern C++ StudyC++ Korea8
![Page 9: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/9.jpg)
Effective Modern C++ StudyC++ Korea9
![Page 10: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/10.jpg)
Effective Modern C++ StudyC++ Korea10
![Page 11: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/11.jpg)
Effective Modern C++ StudyC++ Korea11
![Page 12: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/12.jpg)
Effective Modern C++ StudyC++ Korea12
![Page 13: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/13.jpg)
Effective Modern C++ StudyC++ Korea13
![Page 14: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/14.jpg)
Effective Modern C++ StudyC++ Korea14
![Page 15: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/15.jpg)
Effective Modern C++ StudyC++ Korea15
![Page 16: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/16.jpg)
Effective Modern C++ StudyC++ Korea16
![Page 17: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/17.jpg)
Effective Modern C++ StudyC++ Korea17
![Page 18: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/18.jpg)
Effective Modern C++ StudyC++ Korea18
![Page 19: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/19.jpg)
![Page 20: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/20.jpg)
Effective Modern C++ StudyC++ Korea20
![Page 21: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/21.jpg)
Effective Modern C++ StudyC++ Korea21
![Page 22: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/22.jpg)
Effective Modern C++ StudyC++ Korea22
future std::promise
![Page 23: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/23.jpg)
Effective Modern C++ StudyC++ Korea23
future std::promise
![Page 24: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/24.jpg)
Effective Modern C++ StudyC++ Korea24
future std::promise
![Page 25: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/25.jpg)
Effective Modern C++ StudyC++ Korea25
future std::promise
공유상태(Shared State)
![Page 26: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/26.jpg)
Effective Modern C++ StudyC++ Korea26
![Page 27: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/27.jpg)
Effective Modern C++ StudyC++ Korea27
![Page 28: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/28.jpg)
Effective Modern C++ StudyC++ Korea28
![Page 29: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/29.jpg)
Effective Modern C++ StudyC++ Korea29
std::vector<std::future<void>> futs;
class Widget {
public:
…
private:
std::shared_future<double> fut;
};
![Page 30: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/30.jpg)
Effective Modern C++ StudyC++ Korea30
![Page 31: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/31.jpg)
Effective Modern C++ StudyC++ Korea31
int calcValue(); // 실행할함수
std::packaged_task<int()> pt(calcValue); // 동기적으로수행
auto fut = pt.get_future(); // future를얻음fut의소멸자는어떻게행동할까?
![Page 32: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/32.jpg)
Effective Modern C++ StudyC++ Korea32
std::thread t(std::move(pt)); // t에서 pt실행
![Page 33: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/33.jpg)
Effective Modern C++ StudyC++ Korea33
{
std::packaged_task<int()> pt(calcValue);
auto fut = pt.get_future();
std::thread t(std::move(pt));
…
}
![Page 34: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/34.jpg)
Effective Modern C++ StudyC++ Korea34
![Page 35: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/35.jpg)
Effective Modern C++ StudyC++ Korea35
![Page 36: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/36.jpg)
Effective Modern C++ StudyC++ Korea36
![Page 37: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/37.jpg)
![Page 38: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/38.jpg)
![Page 39: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/39.jpg)
![Page 40: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/40.jpg)
![Page 41: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/41.jpg)
![Page 42: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/42.jpg)
![Page 43: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/43.jpg)
![Page 44: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/44.jpg)
![Page 45: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/45.jpg)
![Page 46: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/46.jpg)
![Page 47: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/47.jpg)
![Page 48: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/48.jpg)
![Page 49: [C++ Korea] Effective Modern C++ Sinchon Study Item 37-39](https://reader034.vdocument.in/reader034/viewer/2022042518/55a85daa1a28abc60b8b486d/html5/thumbnails/49.jpg)