Category Archives: programming

as the name implies…

The obvious final step

The title may be misleading, as I had to invent a new short term for the pattern that occurs in the code once in a while. Example first: During the construction of an XML file when you write an element, … Continue reading

Posted in programming | Tagged , , , | 12 Comments

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

Posted in programming | Tagged , , , | 1 Comment

Local Time

In this post we will see how to solve the task from the previous post, but display the time point in local time instead of system time. The solution is simple and takes only two additional lines (you can scroll … Continue reading

Posted in programming | Tagged , | 5 Comments

Using std::chrono

The goal of this post is to show how the <chrono> library can be used to solve a practical but not that obvious problem. There is a lot of good material in the Internet where one can learn <chrono> from, … Continue reading

Posted in programming | Tagged , , | 12 Comments

Concepts — case studies

This post has been inspired by the readers’ questions about using concepts to solve real problems. We will have a look at two such problems and see if, and how, concepts can help. Case Study 1 My concept has two … Continue reading

Posted in programming | Tagged , , | 3 Comments

Decent concepts

Last year I published two posts on writing concepts: Concept Archetypes, Semantic requirements in concepts. Having had some time to reflect upon these posts, I now realize that the model presented in them is not complete. In this post I … Continue reading

Posted in programming | Tagged , , , | 1 Comment

Contracts, Preconditions & Invariants

In this post we will see what a contract is, how preconditions and invariants can be derived from the contract, and how this process can help detect bugs. Two points that I will be stressing in this post are: (1) … Continue reading

Posted in programming | Tagged , , | 3 Comments

Semantic requirements in concepts

The word ‘concept’ in the context of C++ generic programming has two meanings. The first is more abstract: it is the notion from the domain of Generic Programming (GP) in general. GP is not tied to any specific language: it … Continue reading

Posted in programming | Tagged , , , | 8 Comments

Reflection for aggregates

An aggregate is an array or a class with no user-declared or inherited constructors, no private or protected direct non-static data members, no virtual functions, and no virtual, private, or protected base classes. Aggregates can be initialized in aggregate initialization, … Continue reading

Posted in programming | Tagged , , | 1 Comment