intermediate

Using Monads in C++ to Solve Constraints: 3. The Tale of Two Monads—Bartosz Milewski

Bartosz Milewski continues to explain how to use Monads in C++.

Using Monads in C++ to Solve Constraints: 3. The Tale of Two Monads

by Bartosz Milewski

From the article:

The functional solution to our problem involves the combination of the list monad and the state monad. Mashing two monads together is not trivial — in Haskell this is done using monad transformers — but here I’ll show you how to do it manually...

Handling short codes (part I)--Andrzej Krzemieński

First part of a discussion about designing a type storing character strings of length N (known at compile-time and sufficiently small).

Handling short codes - part I

by Andrzej Krzemieński

From the article:

In my work, we often deal with codes [...] The initial choice was to represent them in programs by type std::string, a general-purpose type for storing sequences of characters. But, as with any general-purpose tools, they fail to take into account the particular usage cases which often offer room for improvements [...] The following is an attempt at the design of a type that would take advantage of the information that we are only storing character strings of length N, where N is sufficiently small (say, no longer than 8)...

Using Monads in C++ to Solve Constraints: 2. The State Monad—Bartosz Milewski

Bartosz Milewski continues to explain how to use Monads in C++.

Using Monads in C++ to Solve Constraints: 2. The State Monad

by Bartosz Milewski

From the article:

We all like making plans, but they are often contingent on the state of our finances. Such plans can be described by functions. In general, a financial plan is a function that takes cash and returns the result paired with the new value of cash. It can be described generically using a template...

Using Monads in C++ to Solve Constraints: 1. The List Monad -- Bartosz Milewski

Bartosz Milewski starts to explain Monads in his recent article.

Using Monads in C++ to Solve Constraints: 1. The List Monad

by Bartosz Milewski

From the article:

I am sometimes asked by C++ programmers to give an example of a problem that can’t be solved without monads. This is the wrong kind of question — it’s like asking if there is a problem that can’t be solved without for loops. Obviously, if your language supports a goto, you can live without for loops. What monads (and for loops) can do for you is to help you structure your code. The use of loops and if statements lets you convert spaghetti code into structured code. Similarly, the use of monads lets you convert imperative code into declarative code. These are the kind of transformations that make code easier to write, understand, maintain, and generalize.

So here’s a problem that you may get as an interview question. It’s a small problem, so the advantages of various approaches might not be immediately obvious, especially if you’ve been trained all your life in imperative programming, and you are seeing monads for the first time.

CppCon 2014 How you can make a Boost C++ Library--Robert Ramey

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:

How you can make a Boost C++ Library

by Robert Ramey

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

The purpose of this presentation is to encourage C++ programmers to create and submit new quality C++ libraries to Boost.

Premises: a) C++ needs more quality libraries b) There are many C++ programmers who would like to contribute libraries but they are discouraged by the amount of effort and associated heartache.

Methodology: Walk through the website www.blincubator.com from the point of view of a C++ library contributor. It will address issues related to requirements, suggested tools, user feedback, library promotion. It will assume that the attendee is an intermediate to advanced C++ programmer with an idea for a library.

5 awesome C++ libraries we use--Edouard

An interesting post on interesting librairies:

5 awesome C++ libraries we use

by Edouard

From the article:

This is an opinionated post about five libraries we use in the production code of quasardb.

We of course use many more great libraries (for example Boost.ASIO which is not listed here). Maybe those five libraries are not the most important, but I felt they deserved some special highlight as they are not so well-known or understood...

Serializing access to Streams -- Marco Foco

A new blog post containing runnable code from the Italian C++ Community:

Serializing access to Streams

by Marco Foco

From the article:

Two or more threads were writing to cout using the form:

cout << someData << "some string" << someObject << endl;

And one of the problems was that data sent from one thread often interrupted another thread, so the output was always messed up. [...] I started designing a solution by giving myself some guidelines, here listed in order of importance...

CppCon 2014 STL Features And Implementation Techniques--Stephan Lavavej

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:

STL Features And Implementation Techniques

by Stephan Lavavej

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

This session will cover selected STL features from C++11/14, both explaining how to use them and delving into implementation techniques that could be useful outside the STL.

I will avoid covering popular features you're already using (e.g. make_shared, make_unique) and obscure features of limited use (e.g. forward_list). The focus will be on useful but underappreciated features like dual-range algorithms, minimal allocators, and heterogeneous associative lookup.