Tag Archives: Boost

(Not) detecting bugs

The following code contains a bug. A developer has spent quite some time looking for the source. The intent of this code is to iterate over two vectors simultaneously, from the first up to the one-before-last element. Thus the most … Continue reading

Posted in programming | Tagged , , , , | 3 Comments

Another polymorphism

In this post we will try to see by a practical example what Boost.Variant is for. You can sometimes see examples that use type variant<int, double, string>, but to me they are artificial: I never needed to use something that … Continue reading

Posted in programming | Tagged , , , , , | 20 Comments

Handling short codes — part I

In my work, we often deal with codes: country codes, airport codes, airline codes, aircraft codes, and more. The thing they have in common is that they are really short. Sometimes 2-letter long, sometimes 3-letter long, sometimes a bit longer. … Continue reading

Posted in programming | Tagged , , , | 32 Comments

String’s interface

What I have to say today is fairly obvious, and you probably know about it. But because I have observed the following pattern in my project’s code fairly frequently, I feel it needs to be recorded. Consider this code: Can … Continue reading

Posted in programming | Tagged , , | 22 Comments

A gotcha with ptr_vector

Recently I came across an interesting gotcha with Boost.Pointer Container library in my project. Making some incorrect assumptions as to what the library does could cause a bug. What would you use boost::ptr_vector for? Why would you need to have … Continue reading

Posted in programming | Tagged , , | 23 Comments

A gotcha with Optional

This post is about one gotcha in Boost.Optional library. When starting to use it, you might get the impression that when you try to put optional<T> where T is expected, you will get a compile-time error. In most of the … Continue reading

Posted in programming | Tagged , , , | 22 Comments

Boost Library Incubator

Today, I wanted to draw your attention to the new initiative driven by Robert Ramey: Boost Library Incubator. It is a place where one can put C++ libraries targeted for inclusion into Boost. One of the biggest Boost’s strengths is … Continue reading

Posted in programming | Tagged | Leave a comment