Type Erasure

Type erasure based on templates is a pretty sophisticated technique. It bridges dynamic polymorphism (object orientation) with static polymorphism (templates).

Read more
Views: 35160

A std::advance Implementation with C++98, C++17, and C++20

In my last post, I presented a possible std::advance implementation based on tag dispatching. One of my readers mentioned that I could also implement std::advance based on constexpr if, or concepts. His right. So let's do it.

Read more
Views: 12947

Software Design with Traits and Tag Dispatching

Tag Dispatching enables it to choose a function based on the type characteristics. This decision takes place at compile time and is based on traits.

Read more
Views: 9095

Policy

Thanks to templates, there are new ways of software design. Policies and traits are two commonly used idioms in C++.

Read more
Tags: Policy
Views: 13233

Avoiding Temporaries with Expression Templates

Expression templates are typically used in linear algebra and are  "structures representing a computation at compile-time, which are evaluated only as needed to produce efficient code for the entire computation" (https://en.wikipedia.org/wiki/Expression_templates). In other words, expression templates are only evaluated when needed. 

Read more
Views: 7373

Mixins

In my previous  post "More about Dynamic and Static Polymorphism", I used the Curiously Recurring Template Pattern (CRTP) to implement static polymorphism. Another typical use case for CRTP is mixins.

Read more
Tags: Mixins, CRTP
Views: 19343

More about Dynamic and Static Polymorphism

In my last post, "Dynamic and Static Polymorphism", I introduced dynamic polymorphism. Today, I continue with static polymorphism and present a very interesting idiom in C++: curiously recurring template pattern (CRTP).

Read more
Views: 26579

Dynamic and Static Polymorphism

Polymorphism is the property that different types support the same interface. In C++, we distinguish between dynamic polymorphism and static polymorphism.

Read more
Views: 43247

constexpr if

In today's post, I want to introduce an exciting C++17 feature: constexpr if. constexpr if enables it to compile source code conditionally and can be used for nice tricks at compile time.

Read more
Views: 14861

constexpr and consteval Functions in C++20

With C++20, constexpr became way more powerful. Additionally, we have  consteval functions in C++20 that are quite similar to constexpr functions.

Read more
Views: 15075

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 4746

Yesterday 4550

Week 4746

Month 26420

All 12104629

Currently are 194 guests and no members online

Kubik-Rubik Joomla! Extensions

Latest comments