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.