Higher-order functions and 'function_ref'
Most modern languages treat functions as first-class citizens, and Modern C++ is no different. The introduction of lambda expressions and utilities such as std::function enable countless functional programming patterns that can increase the flexibility and safety of APIs, and help reduce code repetition on the implementation side. In this talk we're going to see examples of how higher-order functions can be used in practice to increase the quality of production code and the productivity of developers. A new abstraction proposed to the Standard Library for C++20, function_ref, will also be covered and compared to other techniques for the implementation of higher-order functions. function_ref aims to be a lightweight wrapper over any Callable with a given signature that is easy for the compiler to optimize and inline.
Introduction to C++ origami
Fold expressions, introduced in C++17, allow us to easily generate code that combines variadic template arguments together or performs an action on them. After a brief overview of the feature's syntax, this short talk shows some cool and useful utilities that can be implemented using fold expressions. The audience should be familiar with variadic templates - knowledge of C++17 features is not required.
This talk shows an alternative design for future-like continuations that doesn't require any dynamic allocation or type-erasure, while still enabling users to build chains of parallel computations with intuitive constructs such as '.then(...)' and 'when_all(...)'. The idea is to encode every step of the computation chain in the type of a final object, resulting in a very long type that represent the whole tree.
Checking Expression Validity in C++11/14/17
This talk shows multiple ways to gracefully detect whether an expression is ill-formed, progressively covering techniques from C++11 to C++17, using SFINAE, 'static_if', 'if constexpr' and more.
'function_ref': a non-owning reference to a 'Callable'
(Lightning talk) Since the advent of C++11 writing more functional code has become easier: functional programming patterns and idioms have become powerful additions to the C++ developer's toolbox. "Higher-order functions" are one of the key ideas of the functional paradigm - in short, they are functions that take functions as arguments and/or return functions as results. The need of referring to an existing Callable object comes up often when writing functional C++ code, but the Standard Library unfortunately doesn't provide a flexible facility that allows to do so. This talk shows the design and the implementation of 'function_ref', a new non-owning reference to a 'Callable' which has been proposed for standardization.
You must type it three times
(Lightning talk) When developing a library, it is desirable to provide higher-order functions that correctly propagate 'noexcept'-ness and SFINAE-friendliness, in order to behave consistently with the arguments passed by library users. Unfortunately, the language forces us to copy-paste our code three times to achieve this. Why? Can we do better?
Implementing 'variant' visitation using lambdas
The addition of 'std::variant' to the upcoming C++17 standard will introduce a "type-safe sum type" to the Standard Library. Variants model a "choice between types" - they essentially are type-safe "tagged unions". The interface they expose, however, is often more cumbersome to use than it needs to be: defining exhaustive visitors requires the user to create a class with several 'operator()' overloads, or to create a chain of 'if constexpr(...)' calls. Both solutions are not very elegant. After a brief overview of 'std: :variant' and its usefulness, this talk will focus on the implementation of a "lambda-based in-place visitation" approach, where the user can visit a variant by simply providing a set of lambdas on the spot. This will require implementing a way of overloading arbitrary function objects. Recursive variant types will then be covered and the "lambda-based" visitation techniques will be applied to them. This will require implementing the "Y combinator" higher-order function to achieve zero-runtime-overhead lambda recursion. This talk is intended for developers familiar with C++11 and C++14 core language features (lambdas, variadic templates, 'auto', etc...). Prior knowledge of 'std: :variant' or sum types is not required.
Implementing 'static' control flow in C++14
There has always been great interest in imperative compile-time control flow: as an example, consider all the existing 'static_if' proposals and the recently accepted 'constexpr_if' construct for C++17. What if you were told that it is actually possible to implement imperative control flow in C++14? In this tutorial, the implementation and design of a compile-time 'static_if' branching construct and of a compile-time 'static_for' iteration construct will be shown and analyzed. These constructs will then be compared to traditional solutions and upcoming C++17 features, examining advantages and drawbacks.
Implementation of a multithreaded compile-time ECS in C++14
An alternative to deep inheritance trees for game and application architecture design is "composition". Separating data from logic allows the code to be more reusable and more efficient, alongside additional benefits. Using modern C++14 features and heavy metaprogramming, it is possible to design an efficient and user-friendly compile-time multithreaded component-based entity system library, striving for intuitive syntax and cost-free abstractions. By leveraging the compile-time knowledge regarding components and systems, the implementation can figure out what computations can run in parallel and how to efficiently store and manage components.
'static_if' in C++14
(Lightning talk) "static if" and similar constructs would allow C++ developers to create compile-time branches that enable different parts of code depending on a compile-time condition, using familiar "imperative" syntax. This talk shows how to implement a working version of "static_if" in C++14.
(Lightning talk) Casting is an essential in all projects, but can be a source of errors when used improperly. C++ improved upon C's "cast operator" by defining new, stricter and safer casts. To improve code readability and prevent even more mistakes, we can define our own even stricter and safer "meaningful" casts.
'for_each_argument' explained and expanded
During January 2015, Sean Parent posted a very interesting short piece of code on Twitter. The code iterates at compile-time over any number of function arguments, forwarding them one by one to a callable object. How does this code work? What are the possible use cases? Can we make it even more generic and useful? My talk answers all of the questions above, using independently compiled chronologically sequential code segments that show the audience the analysis and improvement process of 'for_each_argument'.
Implementation of a component-based entity system in modern C++
An alternative to deep inheritance trees for game and application architecture design is "composition". Separating data (in independent components) from logic (in independent systems) allows the code to be more reusable and more efficient, alongside additional benefits. Using modern C++11 and C++14 features, it is possible to design an efficient and user-friendly component-based entity system library, with intuitive syntax and convenient cost-free abstractions.
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.