Subscribe
- Follow Andrzej's C++ blog on WordPress.com
-
Recent Posts
Archives
Tag Archives: optional
A moved-from optional
This post is in response to claims, that I have heard number of times, that the semantics of optional’s move operations are wrong: Some people are surprised that the second assert holds: the unfulfilled expectation is that moving from an … Continue reading
Efficient optional values
In this post we will see a library for storing nullable/optional values that can in certain situations replace and outperform Boost.Optional.
Set-up and tear-down
Recently as part of program run-time performance optimization effort, I was scanning through the code for occurrences of keyword new. The goal was to find unnecessary memory allocations. I was surprised to find most of news in the unit test … Continue reading
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
On operator<
Today I want to share with you a more philosophical issue I face with how the meaning of operator< is overloaded in C++. This could cause subtle bugs in programs.
Clever overloading
This post is intended to be a light introduction to certain C++ guru tricks. I want to introduce a couple of concepts that typically put normal people off. If you are an expert you will probably not learn anything new, … Continue reading
Ref-qualifiers
In this post I want to describe a small language feature added in C++11 that, although essential for full value semantics support, is often neglected in tutorials and in compiler implementations.
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