Quick Q: When should I make explicit use of the `this` pointer?

Quick A: to disambiguate.

Recently on SO:

When should I make explicit use of the `this` pointer?

Usually, you do not have to, this-> is implied.

Sometimes, there is a name ambiguity, where it can be used to disambiguate class members and local variables. However, here is a completely different case where this-> is explicitly required.

Consider the following code:

template<class T>
struct A {
   int i;
};

template<class T>
struct B : A<T> {

    int foo() {
        return this->i;
    }

};

int main() {
    B<int> b;
    b.foo();
}

If you omit this->, the compiler does not know how to treat i, since it may or may not exist in all instantiations of A. In order to tell it that i is indeed a member of A<T>, for any T, the this-> prefix is required.

Note: it is possible to still omit this-> prefix by using:

template<class T>
struct B : A<T> {

    using A<T>::i; // explicitly refer to a variable in the base class

    int foo() {
        return i; // i is now known to exist
    }

};

Core C++ 2019 Trip Report--Anastasia Kazakova

It's trip report time!

Core C++ 2019 Trip Report

by Anastasia Kazakova

From the article:

More and more C++ events, community meetups, and conferences are appearing around the globe. 2019 is definitely looking like a year for new C++ conferences. Take, for example, C++ on Sea (UK, in February) or the upcoming CPPP (France, in June). Even C++ Russia now has two editions per year – one in Moscow and one in St. Petersburg. And, finally, there’s the event we just visited – Core C++, held in Tel Aviv, Israel...

CppCast Episode 199: Constexpr Evaluation with Daveed Vandevoorde

Episode 199 of CppCast the first podcast for C++ developers by C++ developers. In this episode Rob and Jason are joined by Daveed Vandevoorde to discuss his contributions to the C++ standard and his recent work on constexpr evaluation.

CppCast Episode 199: Constexpr Evaluation with Daveed Vandevoorde

by Rob Irving and Jason Turner

About the interviewee:

David ("Daveed") Vandevoorde is a Belgian computer scientist who lives near Princeton, NJ, USA. He is vice-president of engineering at the Edison Design Group (EDG), where he contributes primarily to the implementation of their C++ compiler front end. He is an active member of the C++ standardization committee where he is primarily active in the core language evolution work. His recent work in that context has primarily been about extending the capabilities of “constexpr evaluation”. Daveed is also one of the five members of the committee’s “direction group”. He is the primary author of the well-regarded “C++ Templates: A Complete Guide” (now available in its second edition).

ACCU 2019 Autumn Conference - Call for Proposals Open -- ACCU

The Call for Proposals for the ACCU Autumn 2019 Conference to be held 2019-11-11 to 2019-11-12 at Hilton Hotel in Belfast is now open.

Call for Proposals

by ACCU

About the conference:

The call for proposals is open until 2019-06-16.

This conference abuts the WG21 committee meeting so expect lots of C++ folk to be around.

HPX V1.3 released -- STE||AR Group

The STE||AR Group has released V1.3 of HPX -- A C++ Standard library for parallelism and concurrency.

HPX V1.3 Released

The newest version of HPX (V1.3) is now available for download! This release focuses on performance and stability improvements. Please see here for the full release notes.

    HPX is a general purpose parallel C++ runtime system for applications of any scale. It implements all of the related facilities as defined by the C++ Standard. As of this writing, HPX provides the only widely available open-source implementation of the new C++17 parallel algorithms. Additionally, HPX implements functionalities proposed as part of the ongoing C++ standardization process, such as large parts of the C++ Concurrency TS, Parallelism TS V2, data-parallel algorithms, executors, and many more. It also extends the existing C++ Standard APIs to the distributed case (e.g. compute clusters) and for heterogeneous systems (e.g. GPUs).

    HPX seamlessly enables a new Asynchronous C++ Standard Programming Model that tends to improve the parallel efficiency of our applications and helps reducing complexities usually associated with parellism and concurrency.

 

CopperSpice: Declarations and Type Conversions

New video on the CopperSpice YouTube Channel:

Declarations and Type Conversions

by Barbara Geller and Ansel Sermersheim

About the video:

In this video we discuss typedefs and using declarations. We look at how to use typedefs to choose appropriate data types when working with containers, and discuss various issues you can encounter if the correct type is not used. We also examine the complex subject of type conversions, and investigate how type casts work and when they are valid.

Please take a look and remember to subscribe!

Grill the committee in Madrid -- std::cpp conference

During using std::cpp 2019 we had a "Grill the committee" session.

Grill the committee

by std::cpp conference

About the session:

The panel consisted of

  • Axel Naumann (CERN), Swiss National Body.
  • Guy Davidson (Creative Assembly), UK National Body.
  • Timur Doumler. UK National Body.
  • Juan Alday (Bloomberg), US National Body.
  • J. Daniel Garcia (University Carlos III of Madrid), Spanish National Body.

 

Some fun with reactive programming in C++17 -- Joaquín M. López

Some sessions from the recent using std::cpp are now online.

Some fun with reactive programming in C++17

by Joaquín M. López

About the session:

Reactive Programming models program behavior as a directed graph of data dependencies where state changes propagate through callbacks. We introduce the main concepts of RP and some motivational examples through the construction of an RP microframework in C++17 using Boost.Signals2.

Joaquín M López Muñoz is a telecommunications engineer from the Technical University of Madrid (UPM). He started programming at 13 and discovered C++ more than 20 years ago. Member of the Spanish C++ Standards Committee and Boost author (MultiIndex, Flyweight, PolyCollection).

 

Deepening inline -- Jose Caicoya.

Some sessions from the recent using std::cpp are now online.

Deepening inline

by Jose Caicoya

About the session:

inline is a reserved C ++ word that has always been associated with the performance of applications. The C ++ Standard indicates that its implementation "is not required to perform this substitution”, which is, to say the least, confusing. In C++ 11 another meaning radically different was added to the keyword: you can qualify the namespaces to get symbolic versioning. Since C++ 17 inline can be applied to variables, allowing them to be declared and defined in the header files without breaking the one definition rule. In this talk these aspects will be covered, exemplifying their use in Qt libraries, as well as indicating several tips on when and how to use inline.

Jose Caicoya (Velneo) studied Applied mathematics and Computing at Oviedo University and was teaching maths and programming for ten years. Beyond his beginnings with the Zx Spectrum, he became a professional developer and nowadays he enjoys programming at Velneo. He is Member and Secretary of the Spanish C++ Standards Committee.

 

Reflecting C++ -- Axel Naumann

Some sessions from the recent using std::cpp are now online.

Reflecting C++

by Axel Naumann

About the session:

What do you use to not get lost in a new city? A map! Some of today's C++ code is as complex as a metropolis, but mapping it still relies on tools to generate descriptions. Wouldn't it be nice to query C++ code from within C++? To answer questions like "which members do you have?" and "what is your type"? That's what reflection is about. This presentation will introduce the magic of the meta land, the features that open up with reflection in your hand.

In your hand? Yes: a first Reflection TS is scheduled to be published in 2019. In parallel the C++ committee is investing a lot of work in making the interfaces nicer, by making it stdlib's first constexpr library. As one of the Reflection TS authors, I will give you a quick tour of where we are and where it is we are going - which is relevant for any library that wants to live in compile-time space.

Axel Naumann (CERN) graduated as an experimental high energy / particle physicist. After a couple of years in The Netherlands and the US, he is now working at CERN, where he is leading the ROOT project https://root.cern, used by tens of thousands of physicists (and others) with varying coding expertise, to analyze about 1 exabytes of serialized C++ data - all in C++, with dynamic Python bindings. Since 2011, Axel is CERN's representative at the ISO C++ committee. Examples of past presentations include talks at 33C3, ACCU and a Google Tech Talk, as well as lectures and trainings.