Making the Most of C++11/14 -- Sasha Goldshtein

New on Lanyrd:

Making the Most of C++11/14 (slides)

by Sasha Goldshtein

The C++11 standard is already behind us, and C++14 is just around the corner. With a huge variety of language features such as lambdas, rvalue references, auto and decltype, and variadic templates, it's easy to get lost in C++. In fact, it often seems like a completely new and foreign language. In this workshop we will look at the most important language features that improve system performance and developer productivity, with a glimpse towards what C++14 will bring. We will make the most of Visual C++ 2013 and see how to convert and refactor code to use modern C++ idioms.

Post-Rapperswil mailing available

The post-Rapperswil mailing of new standards papers is now available.

Many of the papers in the mailing have already been published individually on this blog.

NOTE: The following are only those papers in the mailing that have not already been publicized on this blog.

WG21 Number Title Author Document Date Mailing Date Previous Version Subgroup Disposition
N4054 PL22.16 2014-06 Rapperswil Minutes Ville Voutilainen 2014-07-03 2014-07      
N4057 A Proposal to Add a Const-Propagating Wrapper to the Standard Library J. Coe, R. Mill 2014-07-02 2014-07 N3973 Library  
N4060 Changes to vector_execution_policy Pablo Halpern 2014-06-11 2014-07   Concurrency  
N4061 Greatest Common Divisor and Least Common Multiple, v3 Walter E. Brown 2014-06-30 2014-07 N3913 Library  
N4064 Improving pair and tuple, revision 2 Daniel Krügler 2014-07-02 2014-07 N3739 Library  
N4065 make_array, revision 2 Zhihao Yuan 2014-06-26 2014-07 N4031 Library  
N4066 Delimited iterators (Rev. 3) M. Spertus, N. Wilson 2014-06-18 2014-07 N4007 Library  
N4068 Toward More Expressive Iterator Tags Bill Seymour 2014-06-28 2014-07   Library  
N4069 C++ Ostream Buffers L. Crowl, P. Sommerlad 2014-06-18 2014-07 N3978 Concurrency  
N4072 Fixed Size Parameter Packs Maurice Bos 2014-05-26 2014-07   Evolution  
N4075 Centralized Defensive-Programming Support for Narrow Contracts (Revision 5) J. Lakos, A. Zakharov, A. Beels 2014-06-20 2014-07 N3997 Library  
N4081 Working Draft, C++ Extensions for Library Fundamentals Jeffrey Yasskin 2014-07-07 2014-07 N4023    
N4082 Programming Languages — C++ Extensions for Library Fundamentals Jeffrey Yasskin 2014-07-07 2014-07      
N4083 Editor's Report for Version 1 of the Library Fundamentals TS Jeffrey Yasskin 2014-07-07 2014-07      
N4084 Working Draft, C++ Extensions for Library Fundamentals, Version 2 Jeffrey Yasskin 2014-07-06 2014-07      
N4085 Editor's Report for Version 2 of the Library Fundamentals TS Jeffrey Yasskin 2014-07-06 2014-07      
N4086 Removing trigraphs??! Richard Smith 2014-06-18 2014-07 N3981 Evolution  
N4088 Task Region R3 P. Halpern, A. Robison, A. Laksberg, H. Sutter, et al. 2014-06-21 2014-07 N3991 Library  
N4089 Safe conversions in unique_ptr<T[]>, revision 2 Geoffrey Romer 20140625 2014-07 N4042 Library  
N4090 The Maladies of All Member Templates: An Incomplete Biography of Specialization (DR727 + DR1755) Faisal Vali 2014-06-21 2014-07 N4042 Library  
N4091 C++ Standard Core Language Active Issues, Revision 90 William M. Miller 2014-07-07 2014-07 N4018 Core  
N4092 C++ Standard Core Language Defect Reports and Accepted Issues, Revision 90 William M. Miller 2014-07-07 2014-07 N4019 Core  
N4093 C++ Standard Core Language Closed Issues, Revision 90 William M. Miller 2014-07-07 2014-07 N4020 Core  
N4094 Response To: Let return {expr} Be Explicit H. Hinnant, V. Voutilainen 2014-07-06 2014-07   Evolution  
N4104 Working Draft, Technical Specification for C++ Extensions for Parallelism Jared Hoberock 2014-07-04 2014-07 N3960    
N4105 Information technology – Programming languages, their environments and system software interfaces – Technical Specification for C++ Extensions for Parallelism Jared Hoberock 2014-07-04 2014-07      
N4106 Parallelism TS Editor's Report, post-Rapperswil Jared Hoberock 2014-07-04 2014-07      
N4107 Working Draft, Technical Specification for C++ Extensions for Concurrency Artur Laksberg 2014-07-07 2014-07 N3970    
N4108 Concurrency TS Editor's Report, July 2014 Artur Laksberg 2014-07-02 2014-07      
N4111 Static reflection (rev. 2) Matúš Chochlík 2014-07-02 2014-07   Reflection  
N4115 Searching for Types in Parameter Packs B. Seymour, S. Lavavej 2014-07-04 2014-07   Library  
N4117 C++ Standard Library Active Issues List (Revision R89) Alisdair Meredith 2014-07-08 2014-07 N3967 Library  
N4118 C++ Standard Library Defect Report List (Revision R89) Alisdair Meredith 2014-07-08 2014-07 N3968 Library  
N4119 C++ Standard Library Closed Issues List (Revision R89) Alisdair Meredith 2014-07-08 2014-07 N3969 Library  
N4120 Null Coalescing Conditional Operator Alexander Bock 2014-07-02 2014-07   Evolution  

 

CppCon Program Highlights, 3 of N: C++ and the Modern Game

The CppCon 2014 conference program has been posted for the upcoming September conference. We've received requests that the program continue to be posted in "bite-sized" posts, a few sessions at a time, to make the 100+ sessions easier to absorb, so here is another set of talks. This series of posts will conclude once the entire conference program has been posted in this way.

 

No C++ conference (or 'Con) would be complete without covering a perennial stronghold for tight C++ code: games. What can be said that hasn't been said before? Some interesting answers will be found in the following talks, which cover the gamut from casual homebrew games to the world's top "AAA" titles... and a little bird tells us there may be some additional leading-edge game-related content still to be announced for CppCon. As always, these talks are by the right people -- Those Who Know and Those Who Do in some of the leading efforts in our industry.

In this post:

  • How Ubisoft Montreal Develops Games for Multicore -- Before and After C++11
  • C++ in Huge AAA Games
  • Quick game development with C++11/C++14

 

How Ubisoft Montreal Develops Games for Multicore -- Before and After C++11

Multicore hit the video game industry in a big way. Every platform we develop for now comes in a multicore configuration, and we're always under pressure to exploit the hardware to its fullest. This talk will share our experience learning to develop C++ software for multicore processors over the last decade. It will also explore the new concurrency support in C++11, and examine the way C++11 has influenced the way we develop multicore software so far.

Speaker: Jeff Preshing, Technical Architect, Ubisoft. Jeff Preshing is a Technical Architect at Ubisoft Montreal, where he's worked on games such as Rainbow Six Vegas, Child of Light and Assassin's Creed Unity. He also maintains a blog where he writes frequently about lock-free programming and the C++11 atomic library.

 

C++ in Huge AAA Games

Video games like Assassin's Creed or Rainbow Six are among the biggest code bases with a single static linking. Iteration-time is critical to develop a great game and keeping a complete compilation-time of a few minutes is a constant challenge. This talk will explain the C++ usage reality at Ubisoft Montreal for huge projects. Ideas will be shared regarding performance, debugging and iteration time.

Speaker: Nicolas Fleury, Technical Architect, Ubisoft. Nicolas Fleury has been in video game industry for over 10 years, working as a Technical Architect on projects like Prince of Persia and currently on Rainbow Six: Siege. Before working in the game industry, he worked in computer assisted surgery, speech recognition and telecoms.

 

Finally, to underscore that C++ is not just for "big AAA" titles, CppCon is very pleased to include this fresh talk by a superb young up-and-coming open source gaming guru -- if you haven't heard his name yet, don't worry, you will:

Quick Game Development with C++11/C++14 

Modern C++ has made game development a much more pleasurable experience. Features such as smart pointers and variadic templates are invaluable in speeding up the development process and in making the code cleaner and more robust. New easy-to-use multimedia libraries such as SFML, SDL and Cinder make dealing with graphics, sounds and input very easy, and work well with modern code principles. This talk guides the audience through the creation of an Arkanoid/Breakout clone in under 200 lines of code, using C++11/C++14 features and idioms. Chronologically sequential code segments, compiled and executed one by one, will show the attendees how a game is created from scratch, slowly becoming a playable product, step by step. The end result will be a small game, completely written in modern C++ code. Topics covered will range from basic graphics programming to entity management and collision detection/response.

Speaker: Vittorio Romeo. Vittorio is an Italian 19 year old Computer Science student at the University of Messina. He started programming at a very young age and soon became an enthusiast of the C++ language. While following the evolution of the C++ standard and embracing the newest features, he worked on many open-source project, such as general-purpose libraries and free multiplatform independent games, which are still being maintained and expanded today. Vittorio also participated as a speaker at Messina's 2013 Linux Day event and he is currently creating an online game-development C++11 video tutorial series for beginners.

Erasing the Concrete -- K-ballo

Have you heard of "type erasure"?

Erasing the Concrete

by K-ballo

From the article:

Type erasure is any technique in which a single type can be used to represent a wide variety of types that share a common interface. In the C++ lands, the term type-erasure is strongly associated with the particular technique that uses templates in the interface and dynamic polymorphism in the implementation.

A union is the simplest form of type erasure.

  • It is bounded, and all participating types have to be mentioned at the point of declaration.

A void pointer is a low-level form of type erasure. Functionality is provided by pointers to functions that operate on void* after casting it back to the appropriate type.

  • It is unbounded, but type unsafe.

Virtual functions offer a type safe form of type erasure. The underlying void and function pointers are generated by the compiler.

  • It is unbounded, but intrusive.
  • Has reference semantics.

A template based form of type erasure provides a natural C++ interface. The implementation is built on top of dynamic polymorphism.

  • It is unbounded and unintrusive.
  • Has value semantics.

CppCon Program Highlights, 2 of N: C++ and the Modern Web

The CppCon 2014 conference program has been posted for the upcoming September conference. We've received requests that the program continue to be posted in "bite-sized" posts, a few sessions at a time, to make the 100+ sessions easier to absorb, so here is another set of talks. This series of posts will conclude once the entire conference program has been posted in this way.

Note: Early Bird registration ends in about 24 hours from the time of this post.

 

Some people seem to think that "web" and "C++" don't belong in the same sentence, but part of what you need to know about modern C++ is how essential it is for web services, how to use web services from C++ code, and the new tools available to compile C++ code to run in the browser -- any browser. In these talks, the CppCon program covers development in this exciting modern area, and we think you'll see that the speakers include the creators of the key technologies -- Those Who Know and Those Who Do in some of the leading efforts in our industry.

In this post:

  • Emscripten and asm.js: C++'s Role in the Modern Web 
  • Embind and Emscripten: Blending C++11, JavaScript, and the Web Browser
  • Using C++ to Connect to Web Services

 

Emscripten and asm.js: C++'s Role in the Modern Web

All major web browsers are written in C++, but C++ is starting to fill an important role in web *content* as well: While JavaScript is the only standards-compliant language available to websites, compiling other languages to JavaScript has been shown to be practical and effective. This talk will explain how Emscripten, an LLVM-based open source compiler from C++ to JavaScript, lets you run a C++ codebase on the web at near-native speed. To achieve that level of performance, Emscripten emits asm.js, a strict subset of JavaScript that is easy for JavaScript engines to optimize, and was designed specifically as a compilation target for languages like C and C++. We'll also discuss some of the more challenging aspects of compiling C++ to JavaScript, stemming from the C++ language itself, libraries and toolchains, and some thoughts on possible solutions.

Speaker: Alon Zakai, Mozilla. Alan works on Emscripten, an LLVM-based compiler from C++ to JavaScript, as well as other projects related to porting existing content to the web. Twitter handle: @kripken

 

Embind and Emscripten: Blending C++11, JavaScript, and the Web Browser

Emscripten compiles C or C++ source code into JavaScript so it can run in a web browser. Emscripten is commonly used to port games to the web with no download or plugin required.

Embind is a C++11 binding library that makes it easy to expose libraries written in C++ to JavaScript. This allows JavaScript applications to take advantage of existing bodies of C++ code. In addition, C++ compiled into the asm.js subset of JavaScript is often faster than hand-written JavaScript, so Embind makes it convenient to accelerate JavaScript applications by writing high-performance functionality in C++.

With several motivating examples, this lecture will cover the design of embind, how variadic templates and constexpr facilitate interesting optimizations, and how embind minimizes its impact on the size of the generated JavaScript.

Speaker: Chad Austin, Technical Director, IMVU. Chad is a Senior Technical Director at IMVU, where he works on highly scalable backend systems, front-end web architectures, and optimizing the bits and bytes of 3D graphics pipelines. C++ was Chad's first love, and he once mowed "C++" into his back yard before a rainstorm, where it stayed for weeks. Website: http://chadaustin.me Twitter: @chadaustin

 

Using C++ to Connect to Web Services

Many languages have great support for connecting to web services. Trying to connect C++ applications to the cloud is difficult. The C++ standard library doesn't contain anything for networking (yet), and with the proliferation of devices, being able to do so in a cross platform manner is even more appealing. Often requiring use of multiple different styled, and potentially low level, libraries where asynchrony wasn't designed from the start. Or by building your own abstract layers over platform and operating system APIs, all of which distract from focusing on the core logic of your application.

The C++ REST SDK makes connecting to services easier by creating APIs focused on simplicity and asynchrony, built using tasks from the Parallel Patterns Library. This is done by putting together a series of cross platform libraries for working with HTTP, WebSockets, JSON, URIs, and OAuth. In many cases building on top of other popular open source libraries like Boost, OpenSSL, and WebSocket++. This talk will take a practical approach looking at what is involved in connecting to some of the common popular services from C++, using the C++ REST SDK and other libraries. Several tutorial style example and demos will be done using C++ code that runs on all the major platforms.

Speaker: Steve Gates, Microsoft. Steve Gates is a senior engineer on the Visual C++ team at Microsoft. Joining Microsoft in 2007, he's worked on various runtimes and libraries for parallel and asynchronous programming, including the Parallel Patterns Library. For the past couple of years he's been focusing on improving the experience in C++ for connecting to services. Specifically working on the C++ Rest SDK (Casablanca) open source project. Outside of work Steve's interests include growing vegetables, food preservation, and eating great food.

Two years of Meeting C++! -- Jens Weller

A lot has changed in just two years. Check this out for some visibility into the European C++ scene.

Two years of Meeting C++!

by Jens Weller

Note: Jens will be giving two talks at two talks at CppCon, including "Founding User Groups." He knows what he's talking about... from the article:

While I only know of 3 active User Groups around 2011/early 2012 (Oslo, Belgium & Düsseldorf), the active user Groups in Europe are a huge success, showing the popularity of C++: ... Also note, that I haven't listed active ACCU Groups, there exist a few in Great Britain, but I'm not sure when they started and how active they are. In total there currently 17 User Groups being active in 2014 or 2013.

C++11 Final Override -- 741MHz

A good article posted last year and making the rounds again this week:

C++11 Final Override

by 741MHz

From the article:

C++11 introduces two important keywords in relation to polymorphism and inheritance — the override and final. Using those keywords should become a habit of any C++ developer. It is worth using every time except when writing a base class. This will make the code clear, maintainable, and potentially save hours that would have been otherwise wasted chasing an error in debugger.

Introducing the CppCon House Band: Jim Basnight

cppcon-basnight.pngAs already announced, CppCon is recording all sessions and panels, including on-mic Q&A. However, note that only the sessions will be recorded, not all of CppCon -- things that you can experience only by attending including lightning talks, BoFs, hackathons, extended Q&A with the 70+ speakers (when you follow them around after their mics turn off or enjoy extended ad-hoc hallway chats), live house band performances, other extra technical and social events in breaks and evening, and...

... wait. Did we say "live house band performances"?

We did indeed.

As part of presenting CppCon, the Foundation is proud to sponsor live music by a great local Seattle area act, The Jim Basnight Band. Jim and the boys  will be playing CppCon all five days and serving up all kinds of original music and covers, from rock and pop to funk and soul and a few surprises. Be sure to get to each day's plenary session early to rock out, and enjoy their Pacific Northwest musical vibe at other times throughout the week. The band has a deep song catalog, so get your requests ready.

We hope you'll join us in September to enjoy not only the deep technical breadth and depth of 2014's premier C++ conference program, but also the round-the-clock "unconference" and musical parts of the fun and refreshing spirit of CppCon.

Hundreds of attendees have already registered for C++'s "Woodstock 2014." Early Bird registration ends tomorrow.

 

(If you're reading this via a newsreader and don't get the embedded audio, visit this post on isocpp.org and enjoy.)

 

N4109: A proposal to add a utility class to represent expected monad -- R1 -- V Escriba, P Talbot

A new WG21 paper is available. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N4109

Date: 2014-06-29

A proposal to add a utility class to represent expected monad -- Revision 1

by Vicente J. Botet Escriba and Pierre Talbot

Excerpt:

1 History

R1- Revision of N4015 [9] after Rapperswil feedback:

  • Switch the expected class template parameter order from expected<E,T> to expected<T,E>.
  • Make the unexpected value a salient attribute of the expected class concerning the relational operators.
  • Removed open point about making expected<T,E> and expected<T> different classes.

2 Introduction

Class template expected<T,E> proposed here is a type that may contain a value of type T or a value of type E in its storage space. T represents the expected value, E represents the reason explaining why it doesn’t contains a value of type T, that is the unexpected value. Its interface allows to query if the underlying value is either the expected value (of type T) or an unexpected value (of type E). The original idea comes from Andrei Alexandrescu C++ and Beyond 2012: Systematic Error Handling in C++ talk [2]. The interface and the rational are based on std::optional N3793 [5] and Haskell monads. We can consider that expected<T,E> is a generalization of optional<T> providing in addition a monad interface and some specific functions associated to the unexpected type E. It requires no changes to core language, and breaks no existing code.

CppCon 2014 Video Recording -- Boris Kolpackov

A very welcome announcement, hot off the press at cppcon.org:

CppCon 2014 Video Recording

by Boris Kolpackov

Every time we post an update on CppCon 2014 someone asks if there will be a recording of the conference. From the beginning we ruled out going the C++Now way by having student volunteers record sessions using consumer camcoders. It is a huge headache for those organizing it just for C++Now’s 3 tracks. It simply won’t scale to CppCon’s 6. So the decision was made to either record professionally or not to record at all. And professional recording of a week-long conference with 6 tracks is not cheap. This is why we couldn’t give a concrete answer until we knew for sure. And now we know for sure: we found a sponsor (can’t yet announce who it is), the contract has been signed, and the entire 6 tracks will be professionally recorded!

Now if you think there is no longer a good reason to attend CppCon in person, let me give you several. There will be recording but no live streaming (live streaming is on a whole new level, expense-wise). Because of the number of sessions involved, we will only be able to publish them about a month later. There will also be no recording of the “unconference” material: lightning talks, hackathons, BoF sessions, extended Q&A, etc.

But the main difference between being there and watching things a month later is missing out on what happens after the talks. Organizers of C++Now like to joke that half of the conference happens between the presentations, in personal interactions.

From personal experience, I spent 1.5 hours after my C++Now presentation chatting to a bunch of attendees who were particularly interested in the topic of my talk. I am not kidding: it was the same length as my presentation! You can’t participate in stuff like this if you are not there.

The bottom line: yes, you will eventually be able to view all the sessions but you will miss out on a lot of fun, personal interactions, and insight that comes with that.

Video recording is also great news for those planning to come. Remember, you can only attend one talk out of every six. But now you will be able to catch up with the video recordings.

If you have never attended a C++ conference and you are not sure whether CppCon is worth it, I hope I managed to convey some of the atmosphere that you can expect. If C++Now is anything to go by, this will be a week where you will learn more about C++ than in the rest of the year all while having a lot of fun.

And remember, the Early Bird registration deadline is tomorrow.