Archiv der Kategorie: C++

Virtual functions in ctor and dtor

During construction and destruction of an object you are able to call virtual functions. But you should not do this. That’s because it is a source for errors as the behavior of the application may be differ from your expectations … Weiterlesen

Veröffentlicht unter C++ | Kommentar hinterlassen

Functor, Lamdba and Predicate

Within this blog article I want to explain the C++ functor, lambda and predicate concepts by using them in short and easy to understand examples.   Functor A functor is a class or struct which acts like a function. This … Weiterlesen

Veröffentlicht unter C++ | Kommentar hinterlassen

Use const whenever possible

The const keyword allows you to specify a semantic constraint: an object should not be modified. And compilers will enforce that constraint. This will allow you to communicate to the compiler and to other developers that the object should remain … Weiterlesen

Veröffentlicht unter C++ | Kommentar hinterlassen

Perfect Forwarding

Perfect forwarding is an implementation concept which helps avoid the forwarding problem. Therefore, if we want to understand the need for perfect forwarding, we have to start by looking at the forwarding problem. This issue can occur when you have … Weiterlesen

Veröffentlicht unter C++ | Kommentar hinterlassen

Scoped vs. unscoped enum

C++ has two kinds of enumerators. You will find several names for both. Following you will see the two kinds of enumerators and some of their names: Standard enum / plain enum / unscoped enum / conventional enum Strong enum … Weiterlesen

Veröffentlicht unter C++ | Kommentar hinterlassen

RValue Reference Declarator: &&

The rvalue reference is a nice c++ feature to create efficient source code. Within this article i want to explain what is meant with an rvalue and how you can use the reference declarator. Furthermore you will learn how to … Weiterlesen

Veröffentlicht unter C++ | Kommentar hinterlassen

Clean Tuples

Depending on the preferences of a developer you may sometimes find a lot of tuples within the source code. Whether this is good or bad practice is another discussion which is not part of this article. Therefore I don’t want … Weiterlesen

Veröffentlicht unter .NET, C++, Clean Code | Kommentar hinterlassen