Articles on software design and programming, C++ and language independent ideas.
Exploring execution of algorithms during explicit template instantiation. Example includes code that generates accessors that are able to mutate private members and call private member functions.
(or Automatic two-phase init) This article presents a solution that enables injection of a custom code to be executed once all the non-static members are initialised. Presented technique is particulary useful in case of constructor inheritance and use of "member initializer" feature.
Among all the various design patterns widely used by the C++ language community, probably only the visitor pattern takes advantage of the language type system in such a sophisticated way. Visitor pattern provides a solution to a recurring problem found in object-oriented designs (and in any other that use runtime-supported subtype polymorphism), namely the determination of the actual type of the object referenced by some interface type. This article will revisit the core idea behind that design pattern, mention couple of existing implementations, and describe a C++14 implementation of the visitor that aims to be flexible and type-safe as much as the template-based solution is, but remains in the domain of fixed (non-template) types favoured by the classic interfaces based on the virtual member functions.
Tweaking std::binary_search to return found item using custom comparator and ordering of intervals and points.
Enforcing stronger typing with couple of alternatives to bitmasks typically used by interfaces to select many properties at once.
Understanding concept requirements put on types by std::swap and taking benefit from std::refrence_wrapper class members.
How to encode assumptions into types and check them during compile time with no use of static_assert.
There examples of C++14 type inference failures and solutions to them.
Let's define an interface by using types and composition, where misuse is signalled by a compilation error.
A note on improving performance through wise usage of short circuiting, simple pattern matching engine with boolean operators and ternary operators.
Enabling iteration over a sequence of objects of given type without changing the type name itself. Plus, how to guarantee never-singular iterators and never-empty collections.
Well designed system is built up from multiple layers, where each layer may be complex piece of software. We will look into a single layer of the system to find out how to make it safe without sacrificing its performance.
Functions defines domain as a set of possible input values and co-domain as a set of possible output values. Let's find a way to assure we receive and reply with meaningful values. An example from production code.
Thoughts on designing software that is easy to test and benefits from dependency injection.
Plenty of software projects use source code generation to automate numerous tedious tasks. Let's have a look how to resolve code generation task in much cleaner way compared to what we find usually and make its results maintainable.