CppCon 2014 Implementing Wire Protocols with Boost Fusion—Thomas Rodgers

While we wait for CppCon 2015 in September, we’re featuring videos of some of the 100+ talks from CppCon 2014. Here is today’s feature:

Implementing Wire Protocols with Boost Fusion

Summary of the talk:

There are a number of common serialization formats available which work well for marshaling C++ types into messaging protocols, e.g. ProtoBufs, Thrift, JSON, XML, FIX, etc. Unfortunately, not every protocol uses one of these popular encodings and instead implements a unique binary protocol. The classical "C" way of handling binary protocols is to use packed structs, unfortunately there are many binary protocols which are not particularly friendly to using this approach due to things like nested variable length data structures, etc.. The packed struct approach is also fairly limited in that it only generally supports primitive POD types.

This talk will explore an approach that uses Boost's Fusion library to implement an easily extensible serialization mechanism for on a non-trivial binary financial exchange protocol which exposes the underlying data in terms of "modern" C++ types. The talk will also cover aspects of general use of Boost Fusion and Boost MPL, type traits, enable_if, SFINAE, and other members of the C++ type system bestiary.

for_each_arg—Eric Niebler

Eric Niebler picked up the Sean Parent's challenge regarding his for_each_argument tweet.

for_each_arg

by Eric Niebler

And after several iterations between Sean and Eric this is the beautiful result:

template<class F, class...Ts>
F for_each_arg(F f, Ts&&...a) {
  return (void)initializer_list<int>{(ref(f)((Ts&&)a),0)...}, f;
}

 

C++11 and 64-bit Issues—Andrey Karpov

Developing 64-bit applications in C/C++ requires much attention from a programmer. There are a number of reasons for 32-bit code to fail to work properly when recompiled for the 64-bit platform. Let's find out if the new features introduced in C++11 have made 64-bit software programmers' life any better and easier.

C++11 and 64-bit Issues

by Andrey Karpov

From the article:

Extensive use of the C++11 language's new constructs in your code doesn't guarantee that you will avoid 64-bit errors. However, the language does offer a number of useful features to help make your code shorter and safer.

A Small Set-Algorithm For Enum Values—Felix Petriconi

Inspired by Sean Parent's recent Tweet I came up with this idea:

A Small Set-Algorithm For Enum Values

by Felix Petriconi

From the article:

Often we have in our own production code statements like this:

auto predicate = [](State state) {
  return state == MyEnumClass::ValueA ||
         state == MyEnumClass::ValueD ||
         state == MyEnumClass::ValueEWithAVeryLongName;
};

A better readable solution with less typing is described there.

Twitter for C++ Programmers—Andrey Karpov

This small post is for those programmers who use Twitter or are just about to start doing this. I'm sure developers will find some useful information here.

Twitter for C++ Programmers

by Andrey Karpov

From the article:

So, you are a C++ programmer. If you are wondering if you can find something interesting for yourself on Twitter, I have a few tips for you.

CppCon 2014 The Canonical Class—Michael Caisse

While we wait for CppCon 2015 in September, we’re featuring videos of some of the 100+ talks from CppCon 2014. Here is today’s feature:

The Canonical Class

by Michael Caisse

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

It was a simpler time. A period in which every college student and learn-C++-in-a-weekend duffer could write a class with the assuredness that it would behave as desired when assigned and copied. There was a check list. Complete the checklist, add some domain specific behaviour, bake in the regression oven, and you were done.

Enter C++11 with its fancy new use of the delete keyword, additional applications of explicit, rvalue references, and some perfect forwarding. How are you to write a "simple" class? Should you include a swap? What does movable mean and are there expected semantics? When is the noexcept specifier used?

During this session we will explore the boilerplate of a C++11 class. The session will touch on rvalue references, move semantics, perfect forwarding, explicit, noexcept, initializer lists, and more as it applies to producing the desired semantics for our classes and structs.

Generic Parallel Programming

A new video from Meeting C++ 2014:

Generic parallel programming for scientific and technical applications

by Guntram Berti

From the talk description:

Technical and scientific applications dealing with a high computational load today face the challenge to match the increasingly parallel nature of current and future hardware. The talk shows how the increased complexity of software can be controlled by using generic programming technologies. The process and its advantages are introduced using many concrete examples...