Inline Functions—Andrzej KrzemieĊ„ski

Today from Andrzej:

Inline Functions

by Andrzej Krzemieński

From the article:

Inlining functions can improve or worsen your program’s performance (however you define ‘performance’). It has been described in detail in Herb Sutter’s GotW #33. Compiler can decide to inline your function, even if it was not declared inline and conversely: it can decide not to inline it even if it is declared inline. So, you might be tempted to think that declaring functions as inline has no useful portable meaning in C++. This is not so. I have found inline functions useful, and its usefulness has nothing to do with inlining...

A Cheat Sheet for HTTP Libraries in C++—Vladimir

cheat-sheet.PNGRecently on Kukuruku:

A Cheat Sheet for HTTP Libraries in C++

By Vladimir

From the article:

... I decided to make a cheat sheet with examples of HTTP requests in C++ using different libraries. I guess Kukuruku is the best place for keeping such cheat sheets.

We’re going to take a look at the following libraries:

  • WinInet
  • WinHttp
  • Casablanca
  • Qt
  • POCO
  • wxWidgets
  • Boost.Asio
  • libcurl
  • neon
  • .NET (С++/CLI)
  • IXMLHTTPRequest
  • HappyHttp
  • cpp-netlib

Erasing the Concrete—K-ballo

Have you heard of "type erasure"?

Erasing the Concrete

by K-ballo

From the article:

Type erasure is any technique in which a single type can be used to represent a wide variety of types that share a common interface. In the C++ lands, the term type-erasure is strongly associated with the particular technique that uses templates in the interface and dynamic polymorphism in the implementation.

A union is the simplest form of type erasure.

  • It is bounded, and all participating types have to be mentioned at the point of declaration.

A void pointer is a low-level form of type erasure. Functionality is provided by pointers to functions that operate on void* after casting it back to the appropriate type.

  • It is unbounded, but type unsafe.

Virtual functions offer a type safe form of type erasure. The underlying void and function pointers are generated by the compiler.

  • It is unbounded, but intrusive.
  • Has reference semantics.

A template based form of type erasure provides a natural C++ interface. The implementation is built on top of dynamic polymorphism.

  • It is unbounded and unintrusive.
  • Has value semantics.

C++11 Final Override—741MHz

A good article posted last year and making the rounds again this week:

C++11 Final Override

by 741MHz

From the article:

C++11 introduces two important keywords in relation to polymorphism and inheritance — the override and final. Using those keywords should become a habit of any C++ developer. It is worth using every time except when writing a base class. This will make the code clear, maintainable, and potentially save hours that would have been otherwise wasted chasing an error in debugger.

The Drawbacks of Implementing Move Assignment in Terms of Swap—Scott Meyers

Hot off the Meyers press: How would you implement move, and why? Scott Meyers explains two related issues:

The Drawbacks of Implementing Move Assignment in Terms of Swap

by Scott Meyers

From the article:

More and more, I bump into people who, by default, want to implement move assignment in terms of swap. This disturbs me, because (1) it's often a pessimization in a context where optimization is important, and (2) it has some unpleasant behavioral implications as regards resource management.

Effective Modern C++ due October, preview in early July—Scott Meyers

Scott Meyers' highly anticipated new book Effective Modern C++ is on the way:

Effective Modern C++ Status Report

by Scott Meyers

From the announcement:

In recent days, two major milestones for Effective Modern C++ have been achieved. First, I sent a draft of the book's Introduction out for technical review. That was the last part of the book to be written, so I finally have a full draft manuscript. Second, I received an image of the book cover from my publisher, so I now know what the book will look like.


  • Early October: Digital versions of the book become available.
  • Late October: Print versions of the book become available.

If you're dying to see what's in the book, and you don't mind dealing with a manuscript that's in draft form (and hence contains technical errors, awkward prose, Item titles in need of revision, primitive diagrams, confusing explanations, and, I hope, some stuff in decent shape), Effective Modern C++ will be part of O'Reilly's Early Release Program, meaning you'll have a chance to see the book in the same form as my technical reviewers. You'll also be able to offer comments on it. As things stand now, the book is slated to be available in Early Release form the week of July 7th.

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.

Masking a Class in Boost Graph, Part 3: Finding the Path—Vadim Androsov

Part 3 of Vadim's experience report about using Boost's graph support in an existing game app:

Masking a Class in Boost Graph. Part 3: Finding the Path

by Vadim Androsov

From the article:

In the previous articles of the series we’ve reviewed the adaptive process of the square game field for concepts of boost graphs. Now we’ll consider the process of finding the path in the square field. Implementation of boost search allows adapting the algorithm quite accurately. In this article we’ll provide just one example of such parameterization – an ability to create various lengths of graph edges. ...

Lightweight HTTP Server in less than 40 Lines on libevent and C++11—NYM

kukuruku.PNGFresh on Kukuruku:

Lightweight HTTP Server in less than 40 Lines on libevent and C++11

by NYM

From the article:

Looking through programming articles sometimes I see posts about creating your own HTTP server. I am most interested in C++ so I often read blogs about it. After looking them through you could easily write you own web server “on sockets” using boost.asio or something else. I also examined libevent and libev. Each of them has its advantages. Libevent is of great interest to me for developing a small HTTP server. Considering some innovations in C++11 the code becomes much more space-efficient and allows for the creation of a basic HTTP server in less than 40 lines.