August 2019

Quick Q: What are copy elision and return value optimization?

Quick A: optimisation compilers are allowed to do for perfomance.

Recently on SO:

What are copy elision and return value optimization?

Copy elision is an optimization implemented by most compilers to prevent extra (potentially expensive) copies in certain situations. It makes returning by value or pass-by-value feasible in practice (restrictions apply).

It's the only form of optimization that elides (ha!) the as-if rule - copy elision can be applied even if copying/moving the object has side-effects...

Enabling Polymorphism in SYCL using the C++ idiom "Curiously Recurring Template Pattern"

Dynamic polymorphism is a widely used C++ feature that allows code to be more flexible, and helps create easily extendable interfaces by overriding the base class specified interfaces inside our derived classes. However, in SYCL kernel code in order to emulate dynamic polymorphism we need to use some curious tricks and techniques.

Enabling Polymorphism in SYCL using the C++ idiom "Curiously Recurring Template Pattern"

by Georgi Mirazchiyski

From the article:

The CRTP idiom offers an alternative approach to polymorphism by providing us with the ability to specify static interfaces, where the base class specifies the the structure of the interface, while the derived one represents the implementation. In this case, the base class does represent the interface and the derived class represents the implementation — similar to the general idea of polymorphism.

CopperSpice: Inline Namespaces

New video on the CopperSpice YouTube Channel:

Inline Namespaces

by Barbara Geller and Ansel Sermersheim

About the video:

In this video, we discuss the purpose of namespaces and the functionality C++11 added with the inline namespace syntax. Join us to find out how inline namespaces can help library developers maintain backward compatibility and how they work.

Please take a look and remember to subscribe!