Contemporary C++ combines C++20 and C++23 features—including coroutines, modules, ranges, concepts, expected types, and execution contexts—to create safe, composable, and maintainable applications. This talk demonstrates how these features work together in practice by building a complete client-server video streaming application that handles real-time networking, media decoding, and GUI rendering, proving that modern C++ enables clean, concise code that is both powerful and enjoyable to write.
Contemporary C++ in Action: Building a Client-Server App with C++20/23
Added:foreign I do I hope you do as well so my talk is up I says he's already said he's a talk that should never exist but let me tell you anyway I will tell you about the motivation for this talk the experiment that I was conducting to make this happen here a demo that I've been programming and my conclusion that I threw from this experiment I'm an electrical engineer I'm in the business of software and Hardware development for a long time at the same time then the voyager's phase probes were launched my professional career was also launched but this face probe came probably far more far along than I probably ever will I'm also for three years now participating in the C plus plus language committee mostly in the evolution working group but also in tooling so whenever I look at social media like Reddit or Twitter and talk about C plus plus or hear about C plus plus there are many people very vocal about defects they know about C plus plus like all these stuff like this is also also a particular segments of the community the committee is too fast or too slow some creative committee is totally detached from reality and probably C plus plus or free is the everything you ever will need in your programming life the rest is just syntactic sugar but is this really true yeah at around mid-may Phil Nash came up to me and was asking me if I could give a talk on his conference 10 weeks later um I should talk about modules once more but I said Phil I don't want to give a talk at all this in this here I'm so occupied with so many other things um I will not talk about modules once again but it will talk about let's figure out if this is really true here maybe I can come up with some application that I can present on the stage at your conference and this should be probably doable in 10 weeks so I did a reality check are these people really through with their assessment of the state of the C plus plus language so I thought this demo application that I will be presenting should contain everything that I have no clue about core language features Library features libraries from third parties that have never been used before or totally failed at and boy did I fail on call routines just the week before so I decided yeah I will bring many of the new C plus 23 features call routines Concepts ranges in particular infinite ranges and make all this stuff work as smoothly together as I possibly can and there's a lot of stuff in here if I fail in this experiment I want to fail as spectacular as I can hide under a rock and program only in Cobol any longer so this is the reason why I have to come up with this talk named contemporary C plus plus in action but what does contemporary possibly mean is it all the old standard that are so foundational to everything that C plus plus is about it's the fabric that underpins everything that we do or is it possibly the Renaissance that was happening in C plus 11. and completed in C plus plus 14.
possibly yes but what about all the new bits and pieces nuts and bolts that came with C plus plus 17.
I couldn't live without them any longer is this contemporary or possibly the new Big Bang as I understand it that came with C plus plus 20 and C plus plus 23.
I think it's probably all of them you can't just say one particular version of C plus plus is modern post-modern or contemporary and what does this in action mean as I already said I'm an engineer and this demo code should sample my daily life all these engineering stuff that I'm doing every day like data collection data processing data visualization real time or near real-time networking of course Library usage we use a lot of link for party libraries we create our own of course and we do interface design by the way all the pictures that I have seen are machines and stuff that we are doing in our company which has 15 people in Germany and the first one was an fpga where I have my own especially programmed and designed micro program dsps that I do and the last one is the largest machine that we ever built in a factory floor at a steel mill this is the range of stuff that we are dealing with so as an engineer I will start with a specification what I'm going to do and then implement this demo code it is a client server application the server waits for connections look at a specific directory for all the files in there and figures out if these files are two files with video in there and decode it and send it at the expected frame rate to a client and if we're a no two files in there at least we get some filler frames and the client will of course connect to the server receive these frames and pre-sent them in a GUI window on the desktop the whole application should behave like application in our systems too so it has to handle failures and timeouts very crazily so that does not just the crash of the application and the clean shutdown should also be possible through the user interaction expected it has a lot of C plus plus 23 in here it totally relies on C plus plus 20 and we want it may contain traces of compile time programming a few things before assume all these using directives and namespace Alias definitions are there and decoding style is the style that we use in our company it's heavily influenced by our German culture I use a couple of libraries first of all the ACI Library this is kind of semi-standardized because it's a reference implementation of the networking TS published in 2018 that Library provides us asynchronous networking and asynchronous execution I'm going to use the lib AV Library which is quite famous that can handle all the media formats I'm using the sdl library to draw the video content on the desktop and it provides a little bit of windowing as well and the last part is a just two functions from our in-house code base in particular a command line options parser lip AV and sclrc libraries and this means the objects that are allocated by these libraries live on the Heap so you have all the usual problems with Heap allocated object and as usual also in C everything has to be done manually has a lot of problems of course that comes from that you all know that this is the typical code that you would expect from using these kind of libraries but I don't like this coat instead I want value types of course this is what we want in C plus plus Dave Abrahams will give a talk later this week on this subject so I don't want to go that much into it to make that happen I created a tiny library that exists of only one templated class that wraps these hip allocated C objects and combines them with the allocation functions and the the allocation free whatever functions and creates True Value types out of that by use of a heavy dose of Concepts and requires expressions the existence or non-existence of Constructors these structures emplacement functions are derived by some kind of reflection of the signatures of these function here we get uniqueness we get consciousness we get in particular independence of these types and composability so we can now write code like you see on the bottom this is much simpler and probably less error prone so let's come to the first part the video decoding I use this wrapper library and create four value types out of it one represents a decoder one represents the media file and we have decoded video frames and data packets used internally that are never empty and also support and use reference Counting the most important data structure here is how we represent our decoded video frames and what type of data do we send over the network first we have a frame header that has the usual properties that you probably expect notice these are bit fields and two of these bit fields are calculated at compile time the sizes of them we have a couple of property functions in particular how many bytes do we need to represent the content of a decoded video frame and what kind of video frame do we have different particular instance of this type the most important part and property of this type is it's trivial so we can relocate instances of this object by bit blasting it or sending this data over the network without changing anything and this is what you actually want here pixels are just a chunk of bytes so a complete video frame is just an header and this block of data with the pixels in there we can create filler frames worth of a couple milliseconds duration and we can actually construct these steps from a decoded video frame returned from delet library designated initializes from C plus 20 come in very handy here and make this Construction very expressive pixels are just a view into the allocated decoded build bytes that exist in the um frame object from the lip AV Library and this is the main function of the whole video decoding process just make frames function takes a directory where all the files live in that we want to decode and it returns a generator that produces video frames for those of you who are not familiar what a generator is it's actually a representation of a range that is sits in front of a cold routine that actually calculates and produces these video frames I generate an endless stream of paths from an infinite directory iterator that iterates over this directory over and over and over again until the end of time each of these paths is then filtered by looking at the extension and read out all the files with extensions that we are not interested in in the First Transformation stage we try to come up with an file that represents and gives us access to the contents and in the second transformation stage I will try to come up with a decoder that can actually decode the contents of this open file at the end of The View pipeline here I get a pair of an open file and a decoder that are the result of this pre-processing if we actually got a decoder from the second transformation state I will print a nice log message on the console and yield all the video frames that come out of the decoding of a file with a decoder if I didn't succeed in getting a decoder I would just send out a filler framework of 100 milliseconds of Darkness this filter is said by a compile time function that takes a compile time string and reconstructs at compile time a closure from the Lambda expression in here the gun can be used at runtime amazing isn't it opening a file is this is just cookbook ffmpeg example code reap reformulated in value types we tried to open this file and get a file and a file object out of it and we accept it but only if this is actually a file that contains GIF in there and this is done by looking at the content and if it actually has a video stream and this is of type shift we accept it otherwise we close the file the decoder is then associated with this file if we can find out now that it is not an still image the three just close the file if it's just a still image otherwise if it's a real Tiff video in there we open the decoder if this is successful I can now return my open file and my decoder to be called the decode Corporal function takes this file and a decoder and returns another generator that creates these video frames and allocates com some assets that's used in the full decoding process that is seen here as long as we're not at the end of a file and can read data from it we sent these data packets to the decoder and ask if we can actually get a decoded video frame out of it if this is true we can yield it and create a video frame that has been shown before if you look carefully with these value types all the craft is removed from the example code that is on the ffmpeg um website we will notice this is just textbook 101 multi-rate Digital Signal processing the only problem what we are facing here the result is produced in the deepest innermost nested scope how can we get the result out of this function here usually these examples in the textbooks don't talk about this problem because this is not as simple as a team we have to invert the control flow come up with a state machine so that you can actually return the results of this decoding process through the return channel of this function but we have C plus plus 20 we have cow routines and can yield our results from the innermost scope through the co yield statement here and because of that the compilable from us and state machine for free this directiveerator is just all the boilerplate what do you expect from an iterator it has a special end iterator it's this Sentinel Tech type every time you compare an iterator with this Tech type we we get a false so this iterator will never come to an end it will iterate until the end of the universe these non-member functions begin and end are here to adapt this iterator to make it actually arrange and also a viewable range in particular it's an infinite range all this code here is a distributed State machine 50 lines of code starts to come up with a very simple operation it took me an enormous amount of time to implement this with all the corner cases and yeah I should have done test driven development once again if you want to go fast you need to pursue it's low these 50 lines of code can actually be replaced by a generator and a call routine in 10 lines of code so the video decoding is done let's talk about the networking and in particular as I said I work in an industrial environment and every i o operation must be protected by a timeout we can't do without failures are just normal sometimes devices do no longer respond so we have to take action on that and so this and socket for example I have to associate it with a timer in many cases we implement this in the typical object-oriented manner this is Justin a pseudo code of a structure that you made might come up with and we have a couple of operations in there the callbacks that could bring back the results of each of these individual operations then they come back from the operating system to us we also have to figure out what the outcome is we have to handle the mutual cancellation of the of the concurrently running other operation and we have to figure out how to come up with a result even in the phase that these callbacks may be produced on different threads this is actually possible in asynchronous execution so we have to have quite some difficult task for before us to actually implement this usually it's done with a state machine and we also need something to cancel these all these outstanding operations if we are for example no longer interested in the outcome of these so if you look at the um the signatures of these asynchronous operations here we will typically see that all these operations take a callable that is called back from then the operating system comes up with a result it usually has some indicator of what has happened if the outcome is successful or there has been an error in there and of course with a value that is produced if everything went smoothly if you look at the call site a possible implementation on the call site maybe it's a Lambda that will have to take a reference to the object itself that was the originator of these calls and the other one of course choose now we have these shared ownership and all the problems that may come in phase of multiple threats writing some data in there so how can we improve the situation let's do some small transformation steps here first let's pack these return arguments so what we get now tuples and in The Next Step wrap these tuples into awaitables that are returned from these asynchronous operations on the call side everything is now very smooth just go away and do a structured binding and get the results out of it the only problem now how to compose this s Andreas told us last day these away tables are highly customizable beasts have lots of buttons to press and leave us to pull practices really difficult to me this sounds more like a task for a library and ACR doesn't let us down here it actually has an operator for concurrent execution of asynchronous operations that takes the availables that come out of them and combines them into an awaitable that gives us a some type of either of these results so that the call side is now extremely simple to implement all the complicated stuff the state machine and these handling of whatever and the concurrency and the data races that are possible here are completely absorbed in this concurrent operation operator from the ACO Library looking at a more realistic example of this thing object we see it has to be allocated on the freestyle has a couple of operations in there and this is only the definition implementation Nicole side isn't even shown here with all the magic from the SEO library now everything is just a function with a single line of code I'm happy with that Andy call side also fits on this slide this is just a cool routine that calls into this create a timely primitive so the assets used here the soccer the timer and the data can be just put into the body of this skull routine and this gives us a couple of very interesting positive features these objects are never shared they are contained within the body of a function so only problems with data sharing are no longer the lifetime is totally clear it reaches through the end of the function and because we have a core weight in the in the call into the times read we can actually make this time read so that it borrows all the necessary assets from the call routine um body in the F function here and this is perfectly safe even and if you have you may probably see that in a asynchronous execution framework this part before the suspension Point may run on a different thread than the part after this suspension point but we actually no longer have to hear about all the stuff this is the reason why the creator of ACO criscollov comes up with this quote this is why C plus plus 20 is the awesomest language for Network programming I think so this is totally true but I threw in another piece a flattened operation that takes this variant to some types of the results of the individual operation and flattens them in turn expected that we have from C plus plus 23 now for both of you that have never experienced or heard about these expected types it's more like an optional on stereotypes you don't know not only get the value but also um the reason why there possibly is no value in them so the call side is now what you get no longer a variant out of it but um a combination of an value type or alternatively the reason for disappointment so I think C plus plus 23 is the even more awesome as language or C plus for networking programming so how does it look like in code we have these tuples from the return with our errors with our results and we want our signatures to return tuples wrapped in available so that we can now morph the regular IO operations IO objects like sockets acceptors and timers so that they return now this particular avoidable types I also have a function that can demote every kind of object into the sequence of bytes that make up their object representation and as explained I use expecteds that have an error code in the disappointment Channel and in the value Channel we get either the amount of data we're tests actually been successfully transferred and in the upper case a socket now if these in place I can formulate my Primitives that I'm going to use Ascent operation within socket and a timer and the data of course and it's just as shown before the flattening of the concurrent operation similarly with the receive operation and a connect operation that in this case returns not a size but an open socket this flattening is done such that it takes this variant of the event individual return types from either of these asynchronous operations figures out what the actual value type is and then visits the variant within variatic generic Lambda that Maps each individual result Tuple into um and the case of something especially it will return the the error in there into the disappointment channel of the expected or if we are successful it will um move the result out through the value channel of the expected so now we have our networking Primitives in place we need an SEO execution framework and and this leads us to executors Hot Topic indeed standard SEO implements executors po443 to be precise but I will not talk about executors at all instead asio gives us an even higher level of abstraction and these are execution contexts that are there as the primary interface to interact and execute asynchronous operation on this framework I won't talk about this either except for one feature asio comes with a couple of services that are part of these execution contexts and are user definable extendable I at and stop service with a stop Source in there and make my execution context pretty similar to water stood chafe red is J Fred executes synchronously these execution contexts execute asynchronously but the interface and the features in there are quite similar now so now I have a means to terminate asynchronous operations from the remote let's look at the code a stop service contains a lot of boilerplate and our stop source I can add a stop source using these services to an execution context I can pull it out again and I can ask for any object that had some kind of relationship to an execution context for the Stop Source in there by pulling the stop Source out of the context that is related to this particular object how is this implemented I can take any type of object and ask for its properties at compile time if it's an execution context we know what to do if it's an executor the executor knows about the execution context and if it's for example a socket that runs on an executor can ask for its executor and this can ask for the execution context and if neither of these is true well let's throw the hands in the air these decisions are all done at compile time and so these functions generate code only for one of these branches this allows me now to implement a function that can abort outstanding operations on a couple of objects at least one of them but possibly more and this function returns a stop callback that watches out for this stop source and whenever a request a topic is requested it will execute a piece of code that is capable of aborting these operations and this is implemented using a C plus plus 17 fold operation over a sequence of calls that are actually just a facade in front of the actual operations required to do it this facade is necessary because of syntactic reasons and this facade on aborting each or any kind of type is also done by figuring out which of the following operations can be done on this object do we need to use a clo a free function called close that can handle this object this close function can be found by argument dependent lookup or has it a close member function or has it a council member function we're happy with either of these if none of this is possible yeah we can't comp We complain a bit so this was the third piece from the requirements list earlier before now we can actually abort outstanding asynchronous operation whenever we need to the second half of these executor part is how to create one with all these capabilities a taken xio context and a stop source and add these stop source to my ioc execution context and then return a closure that can take a piece of work and a couple of arguments and figure out if this piece of work must be called asynchronously then push it until the asynchronous execution framework if it needs to be called synchronously invoked immediately and if neither of these works yeah we know how to complain so I have my networking Primitives I have an executor that can handle all the operations that I need to execute I have my video decoder now I can Implement my server the server is just a call a function call that takes such an i o context a couple of endpoints and key directory to observe for each of the endpoints in this list I create a task that accepts connections and uses an acceptor that listens on this particular endpoint this task is now the owner of this acceptor object so I have to place a watchdog in here that will abort all further operations on the acceptor then a stop is requested as long as the acceptor is open it will accept connections from the clients and create a new task that is supposed to stream videos through this subject a fruit socket the streaming video task is now the owner of the socket and it immediately creates a timer for the actual sending operations and because we are now the owners of the socket and the timer we have to place a watchdog that takes care of both of them I have a Starting Gate kind of thing to make sure that each of these frames are sent out at the correct time with the correct frame rate and here we have the other side the call side of our video decoder remember this function returns a generator that produces decoded video frames on demand every time you pull a video frame out of this range it will come up with the next decoded video frame it then waits for the correct amount to send it out as a given list with the header and the pixels in there and sends them out through the socket within a given send time budget if everything is fine and dandy we continue this press this process as long as we get decoded video frames which is forever in case of a problem we break out this stop gate is just a closure returned here that looks at a particular frame starts a timer and returns an awaitable a that is that can Dandy be co-opaited on in the call side this is the whole server so what we have here is a stage set up by our execution context and we have a couple of individual independent agents that are operating on this stage we have acceptors one for each of the endpoints and each of these acceptors will create new agents that handle the connection that are coming in from the clients each of these agents operate completely on their own nothing is shared here so this means we can scale this as much as we want we can have as many acceptors as we like we can have as many connections as we like we are just limited by the resources of the machine that is this situation is running on nothing is shared as I said so we don't have to even think about stuff like new taxes and a similar bottlenecks that he can enter introduce here you can have as many threads that is this running on nothing needs to is no longer our concern 50 sub F250 server implement it let's look at the client side here the task that is actually in charge of showing us the videos this task is also running on the same execution context it takes a GUI window and a couple of endpoints that the client could connect to if we get a successful connection pass all our current assets like the socket the timer and the GUI window onto the core player then the core player is done like for example the users pushed the close button of the GUI window will request the stop of the whole application foreign ER and the window and once again we have to place a watchdog in here to abort all operations on the circuit and the timer and I also have put a memory resource in here that gives us the buffer of that you can receive pixels into while the socket is open we try to receive a frame and if this is successful we update the dimensions and the shape of the GUI window and draw the pixels onto this window we also lock what we've actually received from this server to the console reception of a single video frame may come up with a well-formed frame that has visible contact it may have invisible content and it may be something that indicates a failure we borrowed the necessary assets because we're strictly nested into the column set up a portion of bytes that they can receive the header into with the correct size and the correct alignment and receive the header if this is successful we can now free animate the header object that is represented by these bytes that we have returned from the network now we have a valid header frame header object within its lifetime we kindly ask our memory resource for a chunk of bytes that is the right size that is advertised through the header and we actually have video content receive it and slice of all the pixels that we have successfully received remember this got is unexpected and we have this value or operation that comes in very handy here if the received by it with the pixel contents in there as advertised in the header we can return a full Media frame otherwise you have to say sorry no picture for you today the next part is it's implemented by the sdl library as already mentioned before you get some value types window renderer and the texture you have some strong types to tell about the width and this height of these GUI windows and have a class in the typical object-oriented manner that is so popular in everything GUI we can create a GUI window we can update the dimensions according to the information contained in the video frame header and we can present the bytes well we have the usual composition in there there's nothing very special about it the composition is of course very easy because we have values full value types the constructors totally boring let's look at the update operation if you have no content in the header advertised oh sorry we update our GUI window only on the first frame in a sequence that is coming from decoding one particular file if there's no content in there we just hide your window in uppercase update all the information and create a new texture and show the window presentation of the pixels in there is we locked the texture that is living in the video memory into to make it accessible through the through this CPU push all the pixels onto this texture unlock it and render put it into the renderer to present it on the on the desktop we also have the typical event Loop that we you do find in every kind of GUI framework here as well and we look out for quit events that come from close pushing the close button and the last missing part is event handling from either determinal that we look out for a couple of signals this is also an Acu IO object that needs to be aborted in case of an closure of the of a close request of the application we can await it and yeah initiate an application stop the same from the GUI and this time it's just pulling the event loop from the GUI Andy stop so far you have to decoder Lefty server they have declined you have all the event handling let's make an application out of it we call our Command parser and get a media directory and a server name out of it and translate the server name and the poured into a couple of end points and Place finally our execution context here and of course desktop source these are the only Parts in this application that are shared between all these agents these are the state that I'm setting up to put all the agents on this execution context that make a scheduler out of it as seen before and start the server to serve if this is successful I start my video player my client with a new GUI window and a list of server endpoints and also the handle for events from determinal and degree so this is the complete picture of the application if our stage with all the actors on accept us connections the video player the actor that handles terminal events and the actor that handles gooey events so what you've seen what are the signature features of this application stuff that I've never been using before generator expected print line stop Source stop token stop callback all the nice stuff from C plus 20.
of course a lot of spans ranges and Views in particular infinite ranges I used a lot of context and even more requires expressions Co routines structured bindings fold expressions right have compile time decisions compile time functions and A Primitive form of compile child reflection in particular I use value types strong types compiler generated closure types and compiler generated State machines all these were the the important parts to compose the function and the operation of the application but there is one more compositional aspect in here and this is the source code composition if we look at the main translucent made translation unit and then the top on the top of it we will see this uses demodularized standard Library a module that contains the stuff from our in-house code base a modularized ACI Library and a couple more named modules that are part of the whole application the whole module structure here it's not only that once seen in this light before within the project there are six named modules one cross flood project header unit Gabby will probably print but um I made it so I have a couple of pre-compiled and cached modules four named modules from external libraries SEO boost program options lip AV and STL and of course the modularized standard Library in fact every module translucent translation unit types that is described in the C plus 20 standard is implemented here and shown as an example we don't have to look at the particular features I have given talks and that the years before just a few examples how these modules look like this one is from our in-house Library it contains this is just a single file module on the left it has the module per view with the exports and the private module fragment with the implementations of the exported functions it uses another module boost program options that provides us the command line person this is also a very simple module it contains of only one function but this time with a with a global module fragment that includes the header from this boost Library and in unfortunately very Boosty manner more than 24 other boost libraries this is probably in terms of source code size the largest translation unit here the STL library is also modularized but this is a little bit more complex it has a Global module fragment and the module perfume with the exports here but in this case it also uses module interface fragments to handle all the macro definitions that are part of the interface of the SLR sdl Library it's kind of ironic that I have to use x markers to get rid of all the macros in here these turn all the macro definitions in the interface into property a proper language entities that I can actually export and usually this is just the context variables that have the same value as the SD macros and lastly the standardized demodularized standard library is also extremely simple it's just a single file module which has the unwrapped C headers in the global module fragment and the C plus plus standard headers and developed C headers that are exported through the name module I'm using the header files of the standard library that Stephanie label lavaway this is who is the maintainer of the um of the Microsoft standard library and has done all the work to make this happen in the For an upcoming version of the CBM the Microsoft modularized standard library and I compiled it here to present it today what does it bring us I tried to figure out how much faster is it to provide the complete API of the C plus plus standard Library through a module in comparison to including all of them it's just about bringing in all the definitions and declarations in case of an include this takes about two seconds on my development machine and this has a bit over 120 000 lines of pre-processed code if I compile it as a module either by re-exporting imported headers or in a proper named module manner that exports only this stuff that has to be visible I got huge benefits importing this API even the slowest one is at least 100 times more faster than including the header files from the standard Library and the PMI the resulting BMI from compiling the standard library in module form is about the same size as the textual representation is I think it's a testament for 40 benefits of providing the C plus plus API through a module this is consistent last year I've been showing the same with the materialized format Library it's just the same ratios that come out of this and this is that let's head over to the compiler and let's figure out if this is just pipe dream or if it compiles I will compile the whole application in release mode this is an extremely slow computer barely capable of even running this e-ide here and let's start it something happened here the program was listening on two endpoints but didn't nothing wrong does anybody have any idea what's wrong no I have just set up the scene this is what I've been showing in the in these slides before I need a threat to execute this execution framework compile it again and start it ah it's not just a pipe dream [Applause] and I can't stop it expected so my conclusion from this experiment is contemporary C plus plus is simple I think this code was not complicated it is concise just few lines of code to make this stuff happen it is safe because of the composition of it using Co routines in particular it is composable not only on the functional side but also on the source code side and therefore I think it is enjoyable and this is my definition what contemporary C plus plus is at this point I want to give a huge thank you to all of the C plus plus committee for all the work that I've done in the past 20 years or so to make this actually happen I want to give a shout out to hardwood Kaiser did this 2015 keynote at meeting C plus plus that has changed how I think about programming and using execution Frameworks executors or something similar instead of threats and also at the same conference there was this promise promise import stood and this is now reality and I think this will change the shape of C plus programming another huge shout out to Stephanie Loverboy for doing all the work to make this happen to Cameron the Camara for the compiler to make this happen for Gabriel just race and be honest through for their work more than 10 years ago on the IPR project that will hopefully shape the landscape of tooling and it's also the underpinning of the BMI implementation of the Microsoft compiler and of course an even more huge shout out to Chris kulhoff the author of The ACO Library this is one of the libraries that has been absolutely foundational to all the codes that are right from more than five years now there are no more threats in my code and there are no more new taxes in my code here are some links for information on videos that you might want to look at also the GitHub repository with this demo code in here and with that I'm done and ready to take questions um I didn't quite understand where the C underscore resource is that something that you took from somewhere or something that you wrote or this is something that I wrote but it didn't show him because it has so many Concepts and requires and compare Time stuff in here didn't want to make you run away I said in the beginning I had a time frame from about 10 weeks then Phil Nash came up to me to have an idea and figure out what I could do to present on his conference C plus plus on C and this took me well probably one hour per day over the course of eight or nine weeks because at the beginning as the usual process of procrastination the second question is how to compiled such as your experiencies plus 20 and 23. as smoothly as you can expect the debugger in here is totally capable of handling this particular kind of code in particular cold routines um just a comment thanks this was mind-blowing and it was particularly nice to see how the variety of features that in C plus plus 20 and 23 can work in combination that is one of the hardest design tasks especially for a large committee so I was very very pleased thanks thank you very much and thanks to the committee [Applause] thank you [Applause] hey uh forgetting run classic mistake um also I didn't quite understand how the Watchdog worked you declared that and then it didn't look like you used it anywhere so what does that do I was just placing this stop callback into the function body and this stop callback object placed in there monitors the stop Source ND execution context that's all about it okay I'll have to look at that later we received another question online from Andrew Stern what steps um actually not that many what you usually have to do if you take an existing piece of code is to get rid of all the um all the um statements and function definitions and all of this kind of stuff that cannot be exported for example if you have translation unit local entities that are unnecessarily so usually have some kind of static definitions in there static functions for example or static variables just get rid of the static and now you can put it into the purview of a module and you get the same effect because a module is compiled only once you don't need this static declarations in here this is the the first thing that you have to do to use the existing code and make it into a module they're probably a little bit more involved here but as I said I have actually set up this demo code as a um as a particular use case to show all things that you need to do and you probably want to know about modules I really would see that all the other compilers and build systems come to a point that this is actually implementable as far as I know there's only one compiler and one build system that can Express this and compile this if you really want to go into modularizing existing code you should probably learn a little bit more about modules I've given talks about that and you probably run into um particular ways to express things in particular SEO with this concept emulation here that brings your compiler to Denise acos X is really a kind of a library that is at the brink of breaking the msbc compiler but it survived so far I hope this answers the question it's not as easy as it usually is if you start with a new module new modules are just writing as you use or if you after you put in your daily work or in your hobby this is a piece of cake but making existing code into modules is a little bit more involved and you should have a little bit of experience in doing so and not not really start with ACO um I have a question about the composed operation that you were showcasing with the logical or so for example you have this time to read where you have two asynchronous operations at the same time and then you just go away on the composed operation say the read succeeded and you have a timeout sitting somewhere don't you need to cancel that how do you or is it just what happens with the other side yeah um this is the beauty of this operator every com every piece of complexity is completely absorbed in the implementation of this operator this is a CO routine on itself and as a user why don't you even want to know how this works as long as it works if you are more interested look at the sources from SEO and probably ask Chris to explain it to you I can't thank you hey I think this was a great example of the progress C plus plus mail doing this 10 years ago would have been quite a nightmare yeah I know at the same time the competition in the industry is also moving forward for example a problem similar to this would be sold by goal or python how do you think these comparison can show us the progress that C plus plus has done and how it Compares in the industry when making choices for the tools to pick to solve the issues well my problem is I have no comparison to go or python because in our company we use only C plus plus and nothing but C plus plus so I have no experience in implementing such kind of thing in goal or python I'm sorry any more questions well then enjoy your day [Applause]
Up Next

Building Self-Healing Scalable Systems: Erlang Architecture Principles
@StrangeLoopConf
81.8K views•2021-03-26

BitTorrent Protocol Explained: Piece Selection & Peer Choking
@StevenGordonAU
481 views•2013-02-22

Lock-Free Queue Correctness: Generation Counters & Memory Ordering
@CppCon
16.2K views•2017-10-28

Enigma Machine Mechanics: WWII Encryption Explained
@JaredOwen
13.2M views•2021-12-11
Related Study Plans & Knowledge Roadmaps
Structured learning paths in Computer Science





























![Keynote: CMake: One Tool To Build Them All - Bill Hoffman [ CppNow 2021 ]](https://i.ytimg.com/vi_webp/wULu83jQmIQ/maxresdefault.webp)









