basics

Why C++ Sails When the Vasa Sank -- Scott Meyers

Now available online, a nice talk by Scott Meyers about why modern C++ is alive and continues to enjoy life and growth:

 

Why C++ Sails When the Vasa Sank

by Scott Meyers

The Vasa was a 17th-century Swedish warship which suffered such feature creep during construction that it sank shortly after leaving the harbour on its maiden voyage. In the early 1990s, the C++ standardisation committee adopted the Vasa as a cautionary tale, discouraging prospective language extensions with "Remember the Vasa!" Yet C++ continued to grow, and by the time C++ was standardised, its complexity made the Vasa look like a rowboat.

The Vasa sank, however, while C++ cruised, and it looks likely to continue doing so even as the latest revised standards (C++11 and C++14) add dozens of new features, each with its own idiosyncrasies. Clearly, C++ has gotten some important things right. In this talk, Scott Meyers considers the lessons to be learned from the ongoing success of a complex programming language that's over 30 years old, yet very much alive and kicking.

Ref-qualified member functions -- Alexander Kulikov

kukuruku.PNGToday on Kukuruku:

Ref-qualified member functions

by Alexander Kulikov

From the article:

Today I’m going to tell you about a new and a little known (to my mind) C++ feature — reference-qualified member functions. I’ll tell about the rules of such functions overloading and, as an example of use, I’ll show you that with the help of ref-qualified you can try to improve the resource management scheme, which is implemented with the help of another C++ idiom — RAII.

Quick Q: Why can't a data member be in a lamba capture list -- StackOverflow

Quick A: Because you can only capture local (stack) objects, including function parameters, and to access a data member in a member function you capture the local variable this.

Today on SO:

Why can't a data member be in a lamba capture list

I have a class foo that has bar as a member variable.

In another member function of the class, I'm writing a lambda function:

[bar](void){}

But I can't include bar in the capture list. Why is that?

Quick Q: How do generic lambdas work? -- StackOverflow

Quick A: They generate a templated operator(), and that means you can call the same closure object with all sorts of different parameters and it just stamps out the function for each set of parameter types.

A "new classic" question on SO, classic because it was posted a year ago, but newly relevant because now the mainstream compilers are implementing the feature:

How does generic lambda work in C++14?

How does generic lambda work (auto keyword as argument type)?

Is it similar to templates where for each different argument type compiler generates functions with the same body but changed types or is it more similar to Java's generics?

Code example:

auto glambda = [](auto a) { return a; };

Preface to Programming: Principles and Practice Using C++, 2nd Edition -- Bjarne Stroustrup

programming-2e.jpgStroustrup's introduction to programming book has now been updated for modern C++. The Preface was posted on InformIT:

Preface to Bjarne Stroustrup's Programming: Principles and Practice Using C++, 2nd Edition

by Bjarne Stroustrup

From the preface:

This book is for someone who has never programmed before but is willing to work hard to learn. It helps you understand the principles and acquire the practical skills of programming using the C++ programming language. My aim is for you to gain sufficient knowledge and experience to perform simple useful programming tasks using the best up-to-date techniques. How long will that take? As part of a first-year university course, you can work through this book in a semester...

C++ User Group Meetings in May

Again, a list of user group meetings for this month. In total its going to be 16 user groups meeting this month:

C++ User Group Meetings in May 2014

by Jens Weller

From the Article:

The Meetings

    8th May C++ UG Aachen - SIMD Programmierung
    8th May C++ UG Belgium
        Parallelism in the C++ Standard, what to expect from C++17
        Asynchronous Programming with futures and await
    8th May C++ UG Dresden - C++ Memory Model
    8th May C++ UG New York - Whats next for C++
    13th May C++ UG Philadelphia - Profiling and Perfomance
    14th May C++ UG San Francisco/Bay area
    15th May C++ UG Malmö/Sweden - Battle of the build systems
    19th May C++ UG Denver - CppNow, Eclipse Configuration, Qt Creator and more...
    20th May C++ UG Berlin - C++ in the demo scene
    21st May C++ UG Düsseldorf - Expression Templates
    21st May C++ UG Hamburg
    21st May C++ UG Seattle/Northwest - Agile Architecture
    23rd May C++ UG Paris
        Introspection et reflection en C++
        Le SIMD en pratique avec boost SIMD
        Clang & C++
    27th May C++ UG Chicago
    28th May C++ UG Heidelberg
    28th May C++ UG San Francisco/Bayarea - C++Now tripreport

Qt & JSON

Recently I could play around with Qt5 JSON API:

Qt & JSON

by Jens Weller

From the Article:

With Qt5 there is a new API for reading and writing JSON files in Qt. In the last days I had the chance to play around with this API, as I implemented importing and exporting different data sets from and to JSON.