Template Metaprogramming - How it All Started

Metaprogramming is programming on programs. C++ applies metaprogramming at compile time. It started in C++98 with template metaprogramming, was formalized in C++11 with the type-traits library, and since C++11 has steadily improved. The main driving force is constant expressions. In this post, I want to write about its roots.

Read more
Views: 15715

Automatic Return Type (C++11/14/20)

I started my discussion about the  "Automatic Return Type (C++98)" in my last post. Today, I'm faced with the same challenge but solve it with C++11, C++14, and C++20.

Read more
Views: 36125

Automatic Return Type (C++98)

Depending on the used C++ standard, there are different ways to return the correct return type of a function template. In this post, I start with traits (C++98), continue in my next post with C++11/14, and end with concepts (C++20).

Read more
Tags: auto
Views: 20629

Dependent Names

A dependent name is essentially a name that depends on a template parameter. A dependent name can be a type, a non-type, or a template parameter. To express that a dependent name stands for a type or a template, you have to use the keywords typename or template.

Read more
Views: 18277

The Special Friendship of Templates

A friend has unrestricted access to the members of a class. Consequently, friendship should be given wisely. Regarding templates, friendship is special.

Read more
Tags: friend
Views: 10560

Visiting a std::variant with the Overload Pattern

Typically, you use the overload pattern for a std::variant. std::variant is a type-safe union. A std::variant (C++17) has one value from one of its types. std::visit allows you to apply a visitor to it. Exactly here comes the overload pattern convenient into play.

Read more
Views: 73611

Smart Tricks with Parameter Packs and Fold Expressions

To complete my post about variadic templates and fold expressions, I present in this post smart tricks using parameter packs and fold expressions.

Read more
Views: 32818

The New pdf Bundle is Ready: C++20 Modules

I have prepared the pdf bundle. To get it is quite simple.

Read more
Views: 8489

From Variadic Templates to Fold Expressions

In my last two posts, "Variadic Templates or the Power of Three Dots" and "More about Variadic Templates", I introduced variadic templates. This post goes one step further in the future, and presents fold expressions that can directly reduce a parameter pack with a binary operator. 

Read more
Views: 19915

Modern C++ Collection

Get all my books about modern C++ in one bundle.

Read more
Views: 8122

Stay Informed about my Mentoring

 

Mentoring

English Books

Course: Modern C++ Concurrency in Practice

Course: C++ Standard Library including C++14 & C++17

Course: Embedded Programming with Modern C++

Course: Generic Programming (Templates)

Course: C++ Fundamentals for Professionals

Course: The All-in-One Guide to C++20

Course: Master Software Design Patterns and Architecture in C++

Subscribe to the newsletter (+ pdf bundle)

All tags

Blog archive

Source Code

Visitors

Today 3981

Yesterday 4344

Week 40859

Month 21105

All 12099314

Currently are 188 guests and no members online

Kubik-Rubik Joomla! Extensions

Latest comments