loading

Logout succeed

Logout succeed. See you again!

ebook img

Programming with C++20: Conceptes, Coroutines, Ranges, and more PDF

pages334 Pages
release year2021
file size1.588 MB
languageEnglish

Preview Programming with C++20: Conceptes, Coroutines, Ranges, and more

Programming with C++20 Concepts, Coroutines, Ranges, and more Andreas Fertig Andreas Fertig Programming with C++20 Concepts, Coroutines, Ranges, and more 1. Edition ©2021 AndreasFertig https://AndreasFertig.Info Allrightsreserved BibliographicinformationpublishedbytheDeutscheNationalbibliothek TheDeutscheNationalbibliothekliststhispublicationintheDeutscheNationalbibliografie;detailedbib- liographicdataareavailableontheInternetathttp://dnb.dnb.de. Theworkincludingallitspartsisprotectedbycopyright.Anyuseoutsidethelimitsofthecopyrightlaw requiresthepriorconsentoftheauthor. Thisappliesinparticulartocopying,editing,translatingand savingandprocessinginelectronicsystems. The reproduction of common names, trade names, trade names, etc. in this work does not justify the assumption that such names are to be regarded as free within the meaning of the trademark and trademark protection legislation and therefore may be used by everyone, even without special identification. Planningandtext: AndreasFertig Coverartandillustrations: FranziskaPanter https://franziskapanter.com Publishedby: FertigPublications https://andreasfertig.info ISBN:978-3-949323-01-0 Thisbookisavailableasebookathttps://leanpub.com/programming-with-cpp20 Thank you, Brigitte & Karl! You opened the world for me. You were alwaysthere,supportingme,lettingmefindmyownway,makingmewhat Iam. To Franziska, without her, I would not have accomplished this project. Nevertiredofremindingmeofmytalents,drivingmewhenI’mtired,keep- ing my focus on. A lot of more could be written here. I like to close with: ThankYou! 4 Using Code Examples Thisbookexiststoassistyouduringyourdailyjoblifeorhobbies. Allexamplesin thisbookarereleasedundertheMITlicense. ThemainreasonfortheMITlicensewastoavoiduncertainty. Itisawellestab- lishedopensourcelicenseandcomeswithoutmanyrestrictions. Thatshouldmake iteasytouseiteveninclosed-sourceprojects. Incaseyouneedadedicatedlicense orhavesomequestionsaroundit,feelfreetocontactme. Code download Thesourcecodeforthisbook’sexamplesisavailableat https://github.com/andreasfertig/programming-with-cpp20 Used Compilers Forthoseofyouwhotrytotestthecodeandliketoknowthecompilerandrevision Iusedhereyougo: ■ g++11.1.0 ■ clangversion13.0.0 6 About the Author AndreasFertig,CEOofUniqueCodeGmbH,isanexperiencedtrainerandlecturer forC++forstandards11to20. AndreasisinvolvedintheC++standardizationcommittee,inwhichthenewstan- dardsaredeveloped.Atinternationalconferences,hepresentshowcodecanbewrit- tenbetter. Hepublishesspecialistarticles,e.g.,foriXmagazine,andhaspublished severaltextbooksonC++. WithC++Insights(https://cppinsights.io),Andreashascreatedaninternationally recognizedtoolthatenablesuserstolookbehindthescenesofC++andthustoun- derstandconstructsevenbetter. Beforeworkingas a trainerand consultant, heworkedforPhilips MedizinSys- teme GmbH for ten years as a C++ software developer and architect focusing on embeddedsystems. Youcanfindhimonlineatandreasfertig.infoandhisblogatandreasfertig.blog 8 About the Book ProgrammingwithC++20teachesprogrammerswithC++experiencethenewfea- turesofC++20andhowtoapplythem. ItdoessobyassumingC++11knowledge. ElementsofthestandardsbetweenC++11andC++20willbebrieflyintroduced,if necessary. However,thefocusisonteachingthefeaturesofC++20. You will start with learning about the so-called big four Concepts, Coroutines, std::ranges,andmodules. Thebigfourafollowedbysmalleryetnotlessimportant features. You will learn about std::format, the new way to format a string in C++. Inchapter6,youwilllearnaboutanewoperator,theso-calledspaceshipoperator, whichmakesyouwritelesscode. Youthenwilllookatvariousimprovementsofthelanguage,ensuringmorecon- sistencyandreducingsurprises.YouwilllearnhowlambdasimprovedinC++20and whatnewelementsyoucannowpassasnon-typetemplateparameters. Yournext stopistheimprovementstotheSTL. Ofcourse,youwillnotendthisbookwithoutlearningaboutwhathappenedin theconstexpr-world. Style and conventions The following shows the execution of a program. I used the Linux way here and skippedsupplyingthedesiredoutputname,resultingina.outastheprogramname. $ ./a.out ut p Hello, Programming with C++20! Out

See more

The list of books you might like