Tag Archives: Boost

Inadvertent conversions

Today I want to warn you about a bug in Boost.Rational library. This illustrates a certain danger connected with allowing convenience conversions from other types. Advertisements

Posted in programming | Tagged , , | 10 Comments

Type erasure — Part IV

Update. The information about boost::hold_any was imprecise. This tool does not work just for any type, but requires that the type provides operators << and >> for writing into and reading it from IOStreams. In this post we will be … Continue reading

Posted in programming | Tagged , , | 8 Comments

Type erasure — Part I

Have you ever came across term type erasure in C++? This “pattern” or “technique” is growing more and more popular. In this post I will try to describe what it is. Note that it is something different than a similar … Continue reading

Posted in programming | Tagged , , , | 17 Comments

Beware of magic values!

Update. The advice I gave below using Boost.Optional was invalid and potentially bug-prone. It is now changed, to reflect my experience with using Boost.Optional. In this post I wanted to show, by a not-so-short example, how the decision to signal … Continue reading

Posted in programming | Tagged , , , | Leave a comment

Using PODs in C++11

In one of my previous posts I tried to show how Boost’s value_initialized can be used to make the usage of PODs (POD = “Plain Old Data”) in C++03 a bit easier. In C++11 this is not necessary. The new … Continue reading

Posted in programming | Tagged , , | 10 Comments

Value-initialization with Boost

One of the fundamental concepts in STL is RegularType. This is more-less what containers expect of their elements: default construction, destruction, copy-ability (copy constructor and copy assignment), movability (move constructor and move assignment), equality (operator==), ordering (operator<). C++ does a … Continue reading

Posted in programming | Tagged , , | 1 Comment

Parsing xml with Boost

Everyone would agree that xml is a rather clumsy format for transferring data, however one essential thing about xml is that it has become a de facto standard for passing information, and lots of platforms and libraries provide tools for … Continue reading

Posted in programming | Tagged , | 48 Comments