Multiplatform C++ - Edouard Alligand @ Meeting C++ 2014

The latest version of Edouard Alligands talk on Multiplatform development with C++:

Multiplattform C++

by Edouard Alligand

From the talk description:

C++ is a multiplatform language, yet many difficulties arise when you want the same code to compile properly and function identically on different platforms. If you put aside the obvious system programming related obstacles, and the differences you might have between compilers (especially when it comes to supporting C++11 and C++14), you come to the surprising conclusion that what is truly hard is all the “little things” you didn’t anticipate.

Quick Q: Why does trying to use a std::move’d object try to copy?—StackOverflow

Quick A: Think of move is (mostly) an optimization of copy, and copy as the "slow" fallback when you can't actually move.

Fresh on SO:

Why does calling std::move on a const object call the copy constructor when passed to another object?

Specifically, the code

#include <iostream>

struct Foo {
    Foo() = default;
    Foo(Foo && x) { std::cout << "Move" << std::endl; }
    Foo(Foo const & x) = delete;

int main() {
    Foo const x; Foo y(std::move(x));

fails to compile with the message:

g++ -std=c++14 test07.cpp -o test07
test07.cpp: In function 'int main()':
test07.cpp:10:36: error: use of deleted function 'Foo::Foo(const Foo&)'
     Foo const x; Foo y(std::move(x));
test07.cpp:6:5: note: declared here
     Foo(Foo const & x) = delete;
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 1

Certainly, I expect it to fail because we can't move a const value. At the same time, I don't understand the route that the code takes before it tries to call the copy constructor. Meaning, I know that std::move converts the element to an x-value, but I don't know how things proceed after that with respect to const.

Targeting Android with the C++ REST SDK—Steven Gates

Fresh on vcblog:

Targeting Android with the C++ REST SDK

by Steven Gates

From the article:

Right before the holidays we put together a new release, version 2.4.0, of the C++ REST SDK. One of the new features added in the library is support for targeting Android using the Visual Studio 2015 cross platform mobile development, as well as the x86 Android emulator. In this post I’m going to walk through showing how to create an Android Native Activity that utilizes the C++ REST SDK...

C++ Status at the end of 2014—Bartlomiej Filipek

A turn-of-the-year retrospective:

C++ Status at the end of 2014

by Bartlomiej Filipek

From the article:

This was a good year for C++!

Short summary (language features):

  • Clang supports C++14
  • GCC supports C++11 and most of C++14 (Full support in upcoming GCC 5.0)
  • Intel 15.0 supports C++11 (some features on Linux/OSX only)
  • Visual Studio tries to catch up with C++11, but it also introduces C++14 features as well... and it become (almost) free!

JSON for Modern C++—Niels Lohmann

A new GitHub project With a very readable README:

JSON for Modern C++

by Niels Lohmann

From the README:

... You can create an object (deserialization) by appending _json to a string literal:

// create object from string literal
json j = "{ \"pi\": 3.141, \"happy\": true }"_json;

[Note: Or perhaps auto j = R"({ "pi": 3.141, "happy": true })"_json; --Ed.]

You can also get a string representation (serialize):

// explicit conversion to string
std::string s = j.to_string();

Quick Q: Why do unique_ptr and shared_ptr treat deleters differently?—StackOverflow

Quick A: Because unique_ptr is designed to be zero-overhead, whereas shared_ptr already allocates space and can easily store the type-erased deleter.

Recently on SO:

Deleter type in unique_ptr vs. shared_ptr

I thought it is very curious when I discovered that the standard defines std::unique_ptr and std::shared_ptr in two totally different ways regarding a Deleter that the pointer may own. 

C++ User Group Meetings in January

A new year, and many more user groups? In January there are already 18 planned meetings:

C++ User Group Meetings in January 2015

by Jens Weller

The Meeting List:

7.1 C++ UG Saint Louis - Deep Dive - Part 1
7.1 C++ UG Santa Barbara - Boost Units
8.1 C++ UG NRW/Aachen - Open Source mit Schwerpunkt C++
8.1 C++ UG Dresden - OpenFoam
14.1 C++ UG Utah - Group in C++
14.1 C++ UG San Francisco/ Bay area - Presentation and Q&A
15.1 C++ UG Madrid - De 0 a 100 (Taller)
15.1 C++ UG Hamburg - Mandelbrot mit MPI
19.1 C++ UG Denver - Denver Tech Center C++ Developers
19.1 C++ UG Austin - North Austin Monthly C/C++ Pub Social
19.1 C++ UG Juce - JUCE C++ Meetup San Francisco
20.1 C++ UG Chicago - CUDA
20.1 C++ UG Juce - JUCE C++ Meetup Los Angeles
21.1 C++ UG Bristol - Save the date
21.1 C++ UG Düsseldorf - Treffen der C++ User Gruppe NRW
22.1 C++ UG Rhein-Neckar - Summary of Meeting C++ Conference and Coding Dojo
22.1 C++ UG Munich - Expression Templates Revisited
28.1 C++ UG San Francisco/ Bay area - Workshop and Discussion Group


The Rule of The Big Four (and a half) – Move Semantics and Resource Management—Glennan Carnie

In this article author discusses the cost of copying and how move semantics help to manage the resources in an efficent manner.

Move Semantics and Resource Management

In the previous article we looked at the issues of resource management in C++ and introduced “The Rule of The Big Three (and a half)”. In this article we’ll extend this concept by looking at the idea of move semantics, a feature introduced in C++11. Move semantics mean we’ll have to extend our rule to “The Rule of The Big Five” or, perhaps more correctly, “The Rule of The Big Four (and a half)”

Interlude: C++’s Strides in 2014—K-ballo

K-ballo’s look at the achievements of C++ completed in 2014 and coming up in 2017, with an overview of draft C++17 features.


by K-ballo

From the article:

One year down the road, 2014 has gone by but not without modifications to the C++ lands. C++14 was completed, and Clang has already reached full conformance! But it's not the end of the road, while the Technical Specification (TS) documents continue to move forward, work has started on what it is intended to be C++17...

Monads in Chains - Ivan Cukic @meetingcpp 2014

Ivan Cukic gave a very good talk on monads at Meeting C++ 2014:

Monads in Chains

by Ivan Cukic

From the talk description:

Monads are scary, and monads are evil. But they are still useful.

In the recent years, the abuse of multi-threading has become apparent and more and more systems started being developed in the reactive, or event-processing style. It allows lowering the number of threads to match the system cores instead of items that are being processed by using non-blocking asynchronous APIs.