C++ Weekly Episode 125: The Optimal Way To Return From A Function—Jason Turner

Episode 125 of C++ Weekly.

The Optimal Way To Return From A Function

by Jason Turner

About the show:

In this episode of C++ Weekly Jason investigates the possible methods that one of two string values might be returned from a function. Which option is best? Which option can the compiler optimize the most? Do we take one return path or multiple return paths? Should a ternary be used?

Customisation points to support interfaces -- Krzysztof Ostrowski

Testable interfaces with polymorphic backends.

Customisation points to support interfaces

by Krzysztof Ostrowski

From the article:

Definition of an interface is not a trivial task. The resulting abstraction that embeds the defined interface actions does not have to be a set of virtual member functions wrapped into a class from which implementations exposed to the user derive. General guideline promoted in this article is to expose non-virtual interfaces to the user while providing a customisation point in the form of a minimal set of actions that can be combined with each other.

CppCast Episode 159: Design Patterns in Modern C++ with Dmitri Nesteruk

Episode 159 of CppCast the only podcast for C++ developers by C++ developers. In this episode Rob and Jason are joined by Dmitri Nesteruk to discuss Design Patterns with Modern C++.

CppCast Episode 159: Design Patterns in Modern C++ with Dmitri Nesteruk

by Rob Irving and Jason Turner

About the interviewee:

Dmitri Nesteruk is a quantitative analyst, developer, course and book author, and an occasional conference speaker. His interests lie in software development and integration practices in the areas of computation, quantitative finance and algorithmic trading. His technological interests include C# and C++ programming as well high-performance computing using technologies such as CUDA and FPGAs.

CppCon 2017: Undefined Behaviour is awesome!--Piotr Padlewski

Have you registered for CppCon 2018 in September? Registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2017 for you to enjoy. Here is today’s feature:

Undefined Behaviour is awesome!

by Piotr Padlewski

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Undefined behavior (UB) is one of the features of C++ that is both loved and hated. Every C++ developer cares about performance, which is why it is very important to understand what the compiler can optimize and what are the language guarantees. Many times programmers are too optimistic about what the compiler can optimize, or they waste time optimizing code by hand.

In this talk you will learn:
- what is the “as-if” rule
- why compilers know less than the programmer — the main problem with Translation Units
- why compilers optimize based on UB, but don't warn about it
- why Undefined Behavior can transcend time, removing your whole code without running 88mph
- why having a more constrained language is better — optimizations that you can’t do in C

In-Place Construction for std::any, std::variant and std::optional--Bartlomiej Filipek

Efficient construction.

In-Place Construction for std::any, std::variant and std::optional

by Bartlomiej Filipek

From the article:

When you read articles or reference pages for std::any, std::optional or std::variant you might notice a few helper types called in_place_* available in constructors.

Why do we need such syntax? Is this more efficient than “standard” construction?

The Incredible Const Reference That Isn’t Const--Jonathan Boccara

To be const or not?

The Incredible Const Reference That Isn’t Const

by Jonathan Boccara

From the article:

While working on the NamedType library I came across a situation that left me stunned in bewilderment: a const reference that allows modification of the object it refers to. Without a const_cast. Without a mutable. Without anything up the sleeve.

How can this be? And how to enforce the const in that const reference?

Full C++17 Filesystem Library Guide -- Nico Josuttis

The latest update of "C++17 - The Complete Guide" now contains a detailed description of the whole new C++17 filesystem library.

Example Code

by Nico Josuttis

About the extension:

50 pages about all elements, all differences between POSIX/Linux and Windows, many examples, many tricks, traps, and hints as well as what changed with the library when it became part of C++17.

All examples were tested both with Visual C++ and g++.

CppCon 2017: Seventeenification: Porting sqlpp11 to C++17--Roland Bock

Have you registered for CppCon 2018 in September? Registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2017 for you to enjoy. Here is today’s feature:

Seventeenification: Porting sqlpp11 to C++17

by Roland Bock

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

The ink on C++17 has merely dried, but the major compilers support most features already. It's high time for a reality check!

This talk is a report about the ongoing effort of porting sqlpp11 to C++17. I'll show real-world usage of the following features:

Core:
inline variables
auto non-type template parameters
[[nodiscard]]
class template deduction
constexpr if
fold expressions

Library:
string_view
optional

This talk also comes with a realization about C++11.

CopperSpice: C++ in review

New video on the CopperSpice YouTube Channel:

C++ in review

by Barbara Geller and Ansel Sermersheim

About the video:

This video marks the one year anniversary of the CopperSpice YouTube channel. In this video we answer questions we have received, talk about a few corrections to our past videos, and also show new examples. One of the examples about overload resolution, is a bit bizarre and well worth checking out.

Please take a look and remember to subscribe!

CppCast Episode 158: Future of 2D Graphics Proposal with Guy Davidson

Episode 158 of CppCast the only podcast for C++ developers by C++ developers. In this episode Rob and Jason are joined by Guy Davidson from Creative Assembly to discuss the future of the 2D Graphics proposal after the C++ meeting in Rapperswil.

CppCast Episode 158: Future of 2D Graphics Proposal with Guy Davidson

by Rob Irving and Jason Turner

About the interviewee:

Guy Davidson is the Coding Manager of Creative Assembly, makers of the Total War franchise, Alien: Isolation and Halo Wars 2, Guy has been writing games since the early 1980s. He is now also a contributor to SG14, the study group devoted to low latency, real time requirements, and performance/efficiency especially for Games, Financial/Banking, and Simulations. He speaks at schools, colleges and universities about programming and likes to help good programmers become better programmers.