Tags » Advanced C#

A friendly type predicate

This is a sequel to the previous post on writing a custom type predicate. One of the readers on Reddit made a very insightful observation. The user has implemented a type that she intends to use with our library, call it… 2,368 more words


Your own type predicate

In this post we will see how to define a type trait or a type predicate or a meta-function that would allow us to check at compile time whether a type exposes an interface that we need. 5,191 more words


Compile-time string concatenation

We will start with a bug, taken from real life. It spans across three files:

#include <string>

struct Service
  static const std::string NAME;
… 3,774 more words

Asserts in constexpr functions

Assertions (like C-style macro assert) are not an ideal, but still useful tool for indicating assumptions about program correctness, and help finding programmer bugs. In this post we will see how we can use assertions in… 1,915 more words