advanced

Quick Q: Why do I have to access template base class members through the this pointer?

Quick: in order to make x a dependent name, so that lookup is deferred until the template parameter is known

Recently on SO:

Why do I have to access template base class members through the this pointer?

If the classes below were not templates I could simply have x in the derived class. However, with the code below, I have to use this->x. Why?

template <typename T>
class base {

protected:
    int x;
};

template <typename T>
class derived : public base<T> {

public:
    int f() { return this->x; }
};

int main() {
    derived<int> d;
    d.f();
    return 0;
}

Teresa Johnsons Meeting C++ 2020 Center Keynote: ThinLTO Whole Program Optimization

Taking a look at next weeks keynote by Teresa Johnson

Teresa Johnsons Center Keynote: ThinLTO Whole Program Optimization: Past, Present and Future

by Jens Weller

From the article:

Whole program optimization enables higher performance in C++ applications, because of the expanded scope for analysis and optimization. Traditionally, whole program optimization is not scalable in memory or time, and doesn't support effective incremental builds. ThinLTO (Thin Link Time Optimization) is a new compilation model that...

A look at next weeks Meeting C++ 2020 online conference

Looking at how next weeks Meeting C++ 2020 will be online

A look at next weeks Meeting C++ 2020 online conference

by Jens Weller

From the article:

First, Meeting C++ 2020 is an online conference, the planned onsite part is canceled. More about this in the last paragraph, as first, lets look whats happening next week!

The online part

Next weeks conference will consist of two tracks hosted in remo, one for talks and one for communication/networking/live video chat...

Jonathan Boccaras Meeting C++ 2020 opening keynote: meta-polymorphism

Some details for the opening keynote of Meeting C++ 2020 in two weeks!

Jonathan Boccaras Meeting C++ 2020 opening keynote: meta-polymorphism

by Jens Weller

From the article:

When you hear polymorphism you may think virtual functions, but this is just one speck of dust in the polymorphism universe.

"C++ Move Semantics - The Compete Guide" is Complete and in Print -- Nicolai Josuttis

The book "C++ Move Semantics - The Complete Guide" is now done and out as ebook or printed.

C++ Move Semantics - The Complete Guide

by Nicolai Josuttis

About the book

On 260 pages (yes, it is that complicated if you want to deal with all the details), Nicolai Josuttis introduces and explains all aspects of C++ move semantics:

  • Intuitive motivation
  • Compelling examples
  • Tricky details

The book covers all aspects of move semantics:

  • From std::move() and rvalue references
  • Over reference qualifiers, invalid moved-from states, and value categories
  • Up to tricky details in generic code using std::forward(), universal/forwarding references, auto&&, and decltype(auto).

Additional chapters about move-only types and the support of move semantics in the C++ standard library help to understand and use standard types in practice.

See cppmove.com for a detailed list of all topics covered.

 

Adding ask me anything to Meeting C++ 2020

Some news about this years Meeting C++ conference: we'll have 2 AMAs!

Adding ask me anything to Meeting C++ 2020

by Jens Weller

From the article:

Some news on Meeting C++ 2020! Attendees will be able to attend AMA sessions with...

During CppCon I noticed how well AMA sessions went and that they are a great feature for an online conference. And for some time I knew that this years conference has some extra space for content due to its online nature.

"C++ Move Semantics - The Complete Guide" now Feature Complete -- Nico Josuttis

The new book by Nico Josuttis is now available as an ebook draft.

C++ Move Semantics - The Complete Guide

by Nico Josuttis

About the book:

Having 200 pages, the description of move semantics is feature complete now. Only a few chapters about the use of move semantics in the C++ standard library are missing.

The book teaches all aspects of C++ move semantics. Starting from the basic principles it motivates and explains all features and corner cases (such as perfect returning with decltype(auto)) so that a C++ programmer can understand and use move semantics right in application code, when implementing classes, in generic code, and in foundation libraries.