仿¥ãYandexã®ãµã³ã¯ãããã«ãã«ã¯ãªãã£ã¹ã§ã䞊åããã°ã©ãã³ã°ã®å°éå®¶ãšã®äŒè°ãéå¬ããŸãã ãã©ã³ã¹ã®ã³ã³ãã¥ãŒã¿ãŒãµã€ãšã³ã¹ç ç©¶æã®
Joel Falku ãMicrosoftã®
Gore Nishanov ãMicrosoft Azureã§åã
Kirk Shoopãæ¥ãŸãã ç¹ã«Habrã®èªè
ã®ããã«ãç§ãã¡ã¯Gor NishanovãšKirk Shupã«åœŒãã®å人çãªçµéšãC ++ã«å¯Ÿããæ
床ãåé¡ãšèšèªéçºã«ã€ããŠè©±ãããã«é Œã¿ãŸããã

ãããã¯ã«èå³ããã人ã®ããã«ã19ïŒ20ã«ã€ãã³ããã
ãããªãããŒããã£ã¹ããéå§ããŸãã äŒè°ã¯è±èªã§éå¬ãããŸãã ãããŒããã£ã¹ãããŒãžã§ãã²ã¹ãã«è³ªåããããšãã§ããŸãã ã©ã€ãæŸéãèŠãæéããªã人ã®ããã«ããã°ããããŠé²é³ãæçš¿ããŸãã
Gor Nishanovã¯ãMicrosoftã®C ++éçºããŒã ã®ããªã³ã·ãã«ãœãããŠã§ã¢ãã¶ã€ã³ãšã³ãžãã¢ã§ãã 圌ã¯ãåŸ
ã€ãããšã«åãçµãã§ããŸãã C ++ããŒã ã«åå ããåããŽã¢ã¯åæ£ã·ã¹ãã ã«åãçµãã§ããŸããã æšå¹Žã圌ã¯Standard C ++ Foundationãäž»å¬ãã幎次CppConäŒè°ã§è¬æŒãè¡ãã C ++ã³ã«ãŒãã³ãçºè¡šããŸããã è² ã®ãªãŒããŒãããã®æœè±¡å ã
C ++ã§ããã°ã©ãã³ã°ãå§ãããã£ãããæããŠãã ããã1992幎以æ¥ãWin32ãšMFCã䜿çšããŠWindowsçšã®C ++ããã°ã©ã ãéçºããããšã§ããŒãã¿ã€ã ã§åããŠããŸããã ãããããã®çµéšã¯ããžãã£ãã§ã¯ãããŸããã§ãã:-) 1996幎ã«
ã¬ã³ã»ã©ãŒå·¥ç§å€§åŠã®å€§åŠé¢ã«å
¥åŠãããšããC ++ã«ç²ŸéããŸããã 圌ã®ãããã§ãã³ã³ãã¥ãŒã¿ãŒãµã€ãšã³ã¹éšéã¯ãåœæã¯ããŸãç¥ãããŠããªãã£ãçŸä»£ã®C ++ã®ç²Ÿç¥ã«æµžããŸããã
å¹çãæãªãããšãªãæœè±¡åãäœæããæ©èœãæ±çšããã°ã©ãã³ã°ãRAIIã®æ£ãã䜿çšã«ãããC ++ãéåžžã«é
åçã«ãªããŸããã å€§èŠæš¡ãªç£æ¥ãããžã§ã¯ãã«ææ°ã®C ++ãé©çšããŠã¿ããã£ãã®ã§ãWindows NTã¯ãã®å®éšã®çŽ æŽãââããåè£ã§ããã ç§ã¯Microsoftãªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã®éšéã§15幎éåããŠãããããã§åºäŒã£ããã¹ãŠã®ãããžã§ã¯ãã§ææ°ã®C ++ã䜿çšããŸããã çµéšã¯æåããããšã倿ããŸããããèšèªãšã©ã€ãã©ãªãæ¹åããæ¹æ³ã«ã€ããŠå€ãã®åžæãèç©ãããŸããã 3ã€ã®ç¹ã«çãåé¡-ãã«ãã¹ã¬ããããã°ã©ã ã®ãšã©ãŒãéåžžã«é
ãã³ã³ãã€ã«ãC ++ãã³ãã¬ãŒãã«é¢é£ããèªã¿åãäžèœãªãã«ãããŒãžã³ã³ãã€ã«ãšã©ãŒ-ã«ã¯è§£æ±ºçãå¿
èŠã§ããã ãããã®åé¡ã®è§£æ±ºãæ¯æŽããããã«ã2013幎ã®çµããã«Visual C ++ããŒã ã«åå ããŸãããã€ãŸãããã«ãã¹ã¬ããããã°ã©ãã³ã°ã®äŸ¿å©ãªãµããŒããC ++ãã¢ãžã¥ã©ãŒã·ã¹ãã ãããã³ãã³ãã¬ãŒãã®æŠå¿µã·ã¹ãã ã«è¿œå ããŸããã åŸè
ã¯ãã§ã«Andrew Suttonã«ããéçºã®æçµæ®µéã«ãããã³ã³ãã€ã©ãžã®ãµããŒãã®è¿œå ã«é¢ãããã®ã§ããã ç§ãçŸåšåãçµãã§ããC ++ã³ã«ãŒãã³ã¯ããã«ãã¹ã¬ããããã°ã©ãã³ã°ã®åé¡ã«å¯Ÿãããœãªã¥ãŒã·ã§ã³ã®äžéšã§ãã ãã¿ãŒã³ã¯ãããŸããããåæ°ãåºããŠã广çãªé«ã¬ãã«ã®æœè±¡åã«ã¯äŸ¡å€ããããšèªåããŠãã ããã
ããããC ++ãæ¹åãã䟡å€ãããã®ã¯ã©ã®åéã§ããïŒç§ã®ããã6ã¯ãã³ã«ãŒãã³ãã¢ãžã¥ãŒã«ãã³ã³ã»ãããã³ã³ãã©ã¯ãããªãã¬ã¯ã·ã§ã³ãåæ/éåæããã°ã©ãã³ã°ããµããŒãããã©ã€ãã©ãªã§ãã ç§ã¯ãã¹ãŠã®ããã°ã©ããŒãç¬èªã®åªå
é äœãªã¹ããæã£ãŠãããšæããŸãã ãã®å Žåãç§ã®ããã6ã¯ç§ãééããåé¡ãåæ ããŠããŸãã
ããªãã®æèŠã§ã¯ããŸã éçºäžã®å°æ¥ã®åºæºã«ãããšãã©ã®ã€ã³ãµã€ããŒãæãè峿·±ãã§ããïŒäž»ãª3ã€ã¯ãã³ã«ãŒãã³ãã¢ãžã¥ãŒã«ãã³ã³ã»ããã§ãã 2ã€ã®å°ããªãã®ïŒããã©ã«ãã®æ¯èŒãçµ±äžããã颿°åŒã³åºãæ§æã ã©ã€ãã©ãªïŒç¯å²ãå®è¡ããã°ã©ã ããããã¯ãŒã¯ã©ã€ãã©ãª
æè¿ãæãå·®ãè¿«ã£ãéçºäžã®åé¡ã¯äœã§ããïŒæªè§£æ±ºã®åé¡ã¯ããã«ãã¹ã¬ããããã°ã©ãã³ã°ã®å¹æçãªãµããŒãã§ãã ã³ã«ãŒãã³ããšã°ãŒãã¥ãŒã¿ãŒããããã¯ãŒãã³ã°ã©ã€ãã©ãªã颿°åãªã¢ã¯ãã£ãããã°ã©ãã³ã°ãªã©ã®éšåçãªãœãªã¥ãŒã·ã§ã³ã¯ãã¹ãŠããŒãã§ããããããŸã§ã®ãšããããããã¯äžè²«ããå
šäœã«çµã¿ç«ãŠãããŠããŸããã
C ++ 17ã®ãæçµãªãªãŒã¹ãã®åã«äœæ¥ãçµäºããäºå®ã§ããïŒC ++ 17ã®æ©èœã¯2016幎æ«ãŸã§ã«æããã«ãªãã§ãããã
ãšã°ãŒãã¥ãŒã¿ãŒã¯ãã€STLã«åå ããŸããïŒ åœŒãã®çŸåšã®ç¶æ³ã¯ïŒC ++ 20ã«ã¯ãŸã ããã€ãã®ææ¡ããããã»ãšãã©ã®å ŽåãC ++ 17ãéãããããŸã§ã³ã³ã»ã³ãµã¹ã«éããªãã§ãããã
æçµçã«std :: asyncã¯ã©ããªããŸããïŒãŸããã©ã®ããã«çœ®ãæããããŸããïŒãŸã å
·äœçãªææ¡ã¯ãããŸããã
C ++ 17ã§ã®äžŠåããã«ãã¹ã¬ããã䞊è¡ããã°ã©ãã³ã°ã¯ã©ã®ããã«å€ãããŸããïŒ æ°ããæ©èœã®å©ããåããŠããã«ãã¹ã¬ãããµãŒããŒã1ç»é¢ã®ã³ãŒãã®é·ãã§èšè¿°ããããã©ãŒæ©èœãèšç»ãããŠããŸããïŒ ãã®å°åã§äœæ¥ããŠããã³ãã¥ããã£ã¡ã³ããŒãŸãã¯ã¯ãŒãã³ã°ã°ã«ãŒãã¯ã©ãã§ãããã€ã³ã¿ãŒãããäžã®ã©ãã§èŠã€ããããšãã§ããŸããïŒæ¬¡ã®2ã€ã®æšæºåäŒè°ã§æç¢ºã«ãªããŸãïŒhttp://isocpp.org/ãopen-std.org/jtc1/sc22/wg21/docs/papers/2015ïŒã
æšæºèŠçŽ ã®ã©ã€ãã©ãªãæ¡åŒµããäºå®ã¯ãããŸããïŒãªãã·ã§ã³ã§ãvariantãstring_spanãarray_spanãC ++ 17ã«å«ãŸããŠããå ŽåããããŸãã
Boostã¯ãè€æ°ããŒãžã®ãšã©ãŒã¡ãã»ãŒãžã§ç¥ãããŠããŸãã ãŸããC ++ãã³ãã¬ãŒãã®ãããã°ã«ã¯ã©ã®ãããªæ¹æ³ã䜿çšããŸããïŒããã¯ãC ++ã«é¢ããç§ã®äžäœ3ã€ã®åé¡ã®1ã€ã§ãã ãã³ãã¬ãŒãã®æŠå¿µã¯ããããåãé€ãã®ã«åœ¹ç«ã€ã¯ãã§ãã æŠå¿µã¯ãããŸããããåæ°ãåºããŠã广çãªé«ã¬ãã«ã®æœè±¡åã«äŸ¡å€ããããšèªåããŠãã ããã
ããªãã®è¶³è·¡ããã©ãããè¥ãéçºè
ã«äœããå§ãããŸããïŒããªãã®éã®ããããšããããŠããŸãããããšãããŠãã ããã
ã«ãŒã¯ã·ã§ãŒãã¯ã1993幎ã«ã€ã³ã¿ãŒã³ãšããŠãã€ã¯ããœããã«å
¥ç€ŸããŸããã 圌ãåãçµãã§ããäž»ãªçŠç¹ã¯ãAzure Machine Learningã§ãã ãŸãã Dash.js ã Blink ã OpenJDK ã Redisãªã©ãå瀟ã®ããã€ãã®ãªãŒãã³ãœãŒã¹ãããžã§ã¯ãã«ãåå ããŠããŸãã Kirkã¯çŸåšãrxcppãasyncãtransducerãªã©ã®éåæã©ã€ãã©ãªãäœæããŠããŸãã Kirkã¯ãã©ã€ãã©ãªãšã³ãŒãã®ã»ãã¥ãªãã£ãšè¡šçŸåãé«ããããã«ãæ°ããã³ã³ãã€ã©æ©èœãåŠç¿ããŠé©çšããããšã奜ã¿ãŸãã
ãªãªãžãã«ãèªãããšã«ãã£ãšèå³ããã人ã®ããã®è±èªã®ã€ã³ã¿ãã¥ãŒC ++ããŒãããèšèšããå Žåãã©ãããŸããïŒ
C ++ã¯ãå®éã«ã¯ããã€ãã®èšèªã®ã»ããã§ãã ããªããã»ããµãCãC ++ããã³ãã¬ãŒã-ããããConceptsãšconstexprããã¹ãŠå¥åã®èšèªã§ãã Cãšã®äžäœäºææ§ã¯æåãããšæããŸããåæ§ã«ãã³ã³ãã€ã«æã«å®è¡ããå®è¡æã«äœ¿çšããåãæäœããã³äœæããCäºæèšèªïŒãµãã»ããïŒãå¿
èŠã§ãã 解決ãããåé¡ã®ã»ãšãã©ã¯ã³ã³ãã€ã«æã®ã³ãŒãå®è¡ããæ©æµãåãããããå€ãã®ãã³ãã¬ãŒãã³ãŒããèšè¿°ããŸããããã®ããããã«ãäžã«ã³ã³ãã€ã©ãŒã«ã¢ã¿ãããããã¬ãŒã¯ãã€ã³ããæã€ãœãŒã¹ãããã¬ãŒãåããå®éã®èšèªãããã°å€¢ãããªãã§ãããã
ããããC ++ãã©ã®æ¹åã«æ¹åããå¿
èŠããããŸããïŒ ããªãã®ã¢ã€ãã¢ã
ã³ã³ãã€ã«æã«åãäœæããã®ã奜ãã§ãã ã³ã³ãã€ã«æã«èå¥ååãäœæãããã§ãã å°ãåã«ææ¡ãããã1ã€ã®ã¢ã€ãã¢ã¯ãScopeGuardã®åäœãã©ã ãæ§æã«è¿œå ããããšã§ããã ãããã£ãŠããFILE file = nullptr; auto fileClose = [ã]ïŒïŒ{ifïŒfileïŒfcloseïŒfileïŒ;} 'æŒç®åã®ä»£ããã«ã³ãŒããããã¯ããã¹ãã©ã¯ã¿ã«çœ®ã颿°ãªããžã§ã¯ããäœæããŸãïŒïŒïŒïŒã
ä»åŸã®C ++æšæºã«ç»å Žããæãè峿·±ãæ©èœã¯äœã§ããïŒ
ä»åŸã®C ++æšæºã«ç»å Žããæãè峿·±ãæ©èœã¯ãco_awaitãco_yieldãco_returnã¯äœ¿çšå¯èœãªéåæã®éèŠãªæ§æèŠçŽ ã§ãã ãã³ãã¬ãŒãã©ã€ãã©ãªããã®åççãªãšã©ãŒã«ã¯ãæŠå¿µãäžå¯æ¬ ã§ãã ã¢ãžã¥ãŒã«ã¯ãã³ã³ããŒãã³ãéã®åé¢ã®æ§ç¯ãå¯èœã«ããããã«äžå¯æ¬ ã§ããããã¯ãã©ã€ãã©ãªéã®äŸåé¢ä¿ãå®è¡å¯èœã«ããããã±ãŒãžãããŒãžã£ãŒãæ§ç¯ããããã«äœ¿çšãããããšãæãŸããŸãã
æè¿ã®ãœãããŠã§ã¢éçºã®æãå®éã®åé¡ã¯äœã§ããïŒ
ç§ã®çŠç¹ã¯ãå¯èœãªå Žåã¯ãã°ããã§ãã¯ã€ã³ã§ãããããã§ãªããã°ãã°ãåºè·ã§ããªãã©ã€ãã©ãªïŒããŒã«ã§ã¯ãªãïŒãæ§ç¯ããããšã§ããã 1ã€ã®äŸïŒãšã©ãŒå€ã倿Žããããããã§ãã¯ãããªããšãã«abortïŒïŒãåŒã³åºãã¹ããŒããšã©ãŒã³ãŒãã¯ã©ã¹ã
C ++ 17ã§äžŠåããã³äžŠè¡ããã°ã©ãã³ã°ã¯ã©ã®ããã«å€åããŸããïŒ åäžã®ç»é¢ã«é©åãããã«ãã¹ã¬ãããµãŒããŒãäœæã§ããããã€ãã®ãã©ãŒæ©èœã¯ãããŸããïŒ ãã®åéã§åããŠããã®ã¯ã©ã®äººãšäœæ¥ã°ã«ãŒãã§ããïŒ ã€ã³ã¿ãŒãããäžã®ã©ãã§ãããã«ã€ããŠèªãããšãã§ããŸããïŒ
asioãšããã€ãã®éåæãã¿ãŒã³ãå®çŸ©ãããïŒããããcoawaitãïŒãåæå®è¡ã³ãŒãããã¹ã¬ãããšãã¥ãŒããã¯ã¹ãåé€ããã¢ã«ãŽãªãºã ãæäŸããåæå®è¡STLã©ã€ãã©ãªã远å ãããããšãæåŸ
ããŠããŸãã
8. C ++ã§ãã«ãã¹ã¬ããããã°ã©ã ãéçºããæ°ããæšæºçãªæ¹æ³ã¯äœã§ããïŒ ããªããéåžžæã£ãŠããå®éçãªåé¡ã¯äœã§ããïŒ
äžŠè¡æ§æœè±¡åã«åºã¥ããŠæ§ç¯ãããã¢ã«ãŽãªãºã ã䜿çšããŠãã¹ã¬ãããåé€ããæœè±¡åã®èåŸã§ããªããã£ã䜿çšãããã¯ããããšãæšå¥šããŸãã äžŠè¡æ§ã®åé¡ã¯ãã³ãŒãæ§é ïŒã¢ã«ãŽãªãºã ã«ãã£ãŠæ¹åãããŸãïŒãšãããã°ã§ãã
ããªãã®è¶³è·¡ããã©ãè¥ãéçºè
ã«å¯Ÿããããªãã®æšå¥šäºé
ã¯äœã§ããïŒ
ããªããããæ°ã«ããããã®ãèŠã€ããããããã®ã³ãŒããæžããããããã®ã³ãŒããèªãã§ãã ããã ç§ã¯å»å¹Žããå»ã£ããã®ãäœããããšæã£ãŠããŸã-çè§£ããŠããªã人ã«ãã£ãŠå€ãããããšããŠããå£ããããšã«æµæããŸãã
ç§ãããã°ã©ãã³ã°ãå§ãããšããç§ã¯ããããã¹ãŠã®äžçŽããã°ã©ããŒãèŠãŠã10幎åŸã«ç§ã¯æçµçã«è¿œãã€ããããããªããšèããŸãããããããŸã§ã«åœŒãã¯ããã«10幎å
ã«ãªããšæããŸããã 10幎åŸãç§ã¯å®éã«å®å
šã«è¿œãã€ããããšãããããŸããã ãã¯ãããžãŒã¯é²æ©ããŠããã®ã§ãç§ã¯äž»æµããå€ãããã¯ãããžãŒãåŠã°ããåæã«äžçŽããã°ã©ããŒãšãšãã«æ°ãããã¯ãããžãŒãåŠã³ãŸããã
C ++ããŒãããèšèšããŠããå Žåãäœã倿ŽããŸããïŒå®éãC ++ã¯ããã€ãã®èšèªã®ã³ã¬ã¯ã·ã§ã³ã§ãã ããªããã»ããµãCãC ++ããã³ãã¬ãŒã-ããããConceptsãšconstexprãã-ã¯ãã¹ãŠå¥åã®èšèªã§ãã Cãšã®åŸæ¹äºææ§ã¯è¯ã解決çã ãšæããŸãããã®é¡äŒŒæ§ã«ãããã¿ã€ãã³ã°æäœã®ããã«ã³ã³ãã€ã«æã«å®è¡ãããCäºæèšèªïŒèšèªã®ãµãã»ããïŒãæã¡ãããšæããŸãã ç§ãåãçµãã§ããåé¡ã®ã»ãšãã©ã¯ããããã®ãœãªã¥ãŒã·ã§ã³ã®ããã€ããã³ã³ãã€ã«æã«å®è¡ãããå Žåã«åã€ãããç§ã¯ç§ã®äººçã§ãã³ãã¬ãŒãã«å€ãã®ã³ãŒããæžããŸããã ãã®ãããã³ã³ãã€ã©ã«é¢é£ãããããã°æ©èœãšãããã°æ©èœãåããéåžžã®èšèªã¯åãªã倢ã§ãã
ã©ã®é åã§æåã«C ++ãéçºããå¿
èŠããããŸããïŒã³ã³ãã€ã«æã«åãäœæããã®ã奜ãã§ãã ã³ã³ãã€ã«æã«ååãå®çŸ©ã§ãããšäŸ¿å©ã§ãã å°ãåã«ææ¡ãããå¥ã®ã¢ã€ãã¢ã¯ãScopeGuardãã©ã ãæ§æã«è¿œå ããããšã§ãã
æ°ããC ++æšæºã«ã¯äœãé¢çœãã§ããããïŒæãè峿·±ãæ©èœ-co_awaitãco_yieldãco_returnã¯ã䟿å©ãªéåæã®éèŠãªã³ã³ããŒãã³ãã§ãã ãã³ãã¬ãŒãäžã®ã©ã€ãã©ãªããã®éåžžã®ãšã©ãŒã¡ãã»ãŒãžã«ãšã£ãŠãæŠå¿µã¯éåžžã«éèŠã§ãã ã³ã³ããŒãã³ãéã®åé¢ãäœæããã«ã¯ãã¢ãžã¥ãŒã«ãå¿
èŠã§ããããã¯ãã©ã€ãã©ãªéã®äŸåé¢ä¿ãçè§£ããã®ã«åœ¹ç«ã€ããã±ãŒãžãããŒãžã£ãŒãäœæããããã«äœ¿çšãããããšãæåŸ
ããŠããŸãã
仿¥ã®éçºã§æãé¢é£ããåé¡ã¯äœã§ããïŒç§ã¯åžžã«ãšã©ãŒããã£ããããããšããããããŠäžè¬çã«ãããã®å€èгããç§ãè§£æŸããïŒããŒã«ã§ã¯ãªãïŒã©ã€ãã©ãªã®éçºã«éäžããŠããŸããã äŸã¯ããšã©ãŒå€ã倿ŽãããããŸã 解決ãããŠããªããšãã«abortïŒïŒãåŒã³åºããšã©ãŒã³ãŒãã®ã¹ããŒãã¯ã©ã¹ã§ãã
ãã«ãã¹ã¬ããããã°ã©ã ã®éçºã¯ãC ++ 17ã§ã©ã®ããã«å€ãããŸããïŒ 1ã€ã®ç»é¢ã§ãã«ãã¹ã¬ãããµãŒããŒãäœæã§ããããã«ããã¯ãŒã«ãªæ©èœã¯ãããŸããïŒ èª°ãããã«åãçµãã§ããŸããïŒasioãšéåæããŸãã¯å€åcoawaitã®ãããã¿ãŒã³ãããå ŽåãSTLã§ãã«ãã¹ã¬ãããèŠãããããšãé¡ã£ãŠããŸãã ããã«ããããã«ãã¹ã¬ããå®è¡ã®ã³ãŒãã§ã¹ã¬ãããšãã¥ãŒããã¯ã¹ã䜿çšãããªããªããŸãã
ä»ãããã«ãã¹ã¬ããC ++ã³ãŒããæžãæ¹æ³ã¯ïŒç§ã¯åžžã«ãæœè±¡ã¬ãã«ã«å¿ããŠã¹ã¬ãããšããã¯ã®åå§çãªäœ¿çšãåé€ããåæå®è¡æœè±¡ã«åºã¥ãã¢ã«ãŽãªãºã ãæ±ããŠããŸãã
ããªãã®éãé²ã¿ããè¥ãéçºè
ã«äœããå§ãããŸããïŒããªããããæ°ã«ããããã®ãèŠã€ããããããã®ã³ãŒããæžããããããã®ã³ãŒããèªãã§ãã ããã ããã¯ãç§ãããããè¡ã£ãŠããé·å¹Žã«ããã£ãŠååšããããããçè§£ããŠããªã人ã
ããããã«å ããå€åã®åŸã§ãå£ããªããã®ãæ§ç¯ããããã«ä¿ããŸãã
ããã°ã©ãã³ã°ãå§ãããšããç§ã¯çµéšè±å¯ãªéçºè
ãèŠãŠã10幎åŸã«ã¯åœŒãã®çŸåšã®ã¬ãã«ã«è¿œãã€ãã ãããšæã£ããã圌ãã¯ãã§ã«10幎åã«é²ãã ããã 10幎åŸãç§ã¯å®éã«åœŒãã«å®å
šã«è¿œãã€ããŠããããšã«æ°ä»ããŸããã ãã¯ãããžãŒã¯é²æ©ããŠããã®ã§ãå€ããã¯ãããžãŒãåŠã¶å¿
èŠã¯ãããŸããã§ããããåæã«æ°ãããã¯ãããžãŒãåŠã³ãŸããã