experimental

Providing a stable memory address to an external API

A post on how to provide a pointer to a Qt Model/View or other APIs storing pointers to their data without using shared_ptr or unique_ptr for the actual object.

Providing a stable memory address

by Jens Weller

From the article:

Some APIs allow you to store a pointer to your data element. This is used to access additional information from your types to display them in Model/View Architecture.

A while ago I showed how you can implement a tree with shared_ptr and enable_shared_from_this and then display this in QTreeView. And when working on my current project I knew this problem would come around again. Maybe not for a tree and a tree view, but I'll clearly need to have some way to have ui panels display and edit my data classes and store a stable memory adress as a pointer in Qt models. Back in 2015 the Qt5 example still used a pointer allocated with raw new for this, in Qt6 the example uses unique_ptr. Using shared_ptr for this back in 2015 was a good decision, and the code works very well. For the moment I don't see that my current project would need to make use of enable_shared_from_this, so using unique_ptr would be a good option...

 

 

Merging intervals in next-gen C++--Marco Arena

Revisiting a classical programming puzzle in next generation C++:

Merging intervals in next-gen C++

by Marco Arena

From the article:

A few weeks ago, I set this problem at Coding Gym: given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input...

An experimental successor to C++

An experimental successor to C++
 

About Carbon:

C++ remains the dominant programming language for performance-critical software, with massive and growing codebases and investments. However, it is struggling to improve and meet developers' needs outlined above, in no small part due to accumulating decades of technical debt. Incrementally improving C++ is extremely difficult, both due to the technical debt itself and challenges with its evolution process. The best way to address these problems is to avoid inheriting the legacy of C or C++ directly, and instead start with solid language foundations like a modern generics system, modular code organization, and consistent, simple syntax.

New C++ features in GCC 12--Marek Polacek

Time to update.

New C++ features in GCC 12

by Marek Polacek

From the article:

Version 12.1 of the GNU Compiler Collection (GCC) is expected to be released in April 2022. Like every major GCC release, this version will bring many additions, improvements, bug fixes, and new features. GCC 12 is already the system compiler in Fedora 36. GCC 12 will also be available on Red Hat Enterprise Linux in the Red Hat Developer Toolset (version 7) or the Red Hat GCC Toolset (version 8 and 9).

Like the article I wrote about GCC 10, this article describes only new features affecting C++.

We implemented several C++23 proposals in GCC 12. The default dialect in GCC 12 is -std=gnu++17; to enable C++23 features, use the -std=c++23 or -std=gnu++23 command-line options. (The latter option allows GNU extensions.)

Note that C++20 and C++23 features are still experimental in GCC 12...

Taming the power of C++ with AI

A new blog article on an exciting idea for C++

Taming the power of C++ with AI

by Jens Weller

From the article:

In January Bryce Adelstein Lelbach gave a talk about NDVIDIAS CUDASTL fork at my online C++ User Group. Shortly after this talk was published on YouTube I got contacted by a start up, seeking feedback on their ideas of accelerating C++ with help of GPUs and AI...

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...