A Non-Obvious Feature in the Syntax of Variable Declaration

Written by Maxim Razin

Take a look at this innocent looking piece of code in C++. There are no templates, no virtual functions or inheritance, but the creators of this beautiful language hid a gift right in front of us. struct A { A (int i) {} }; struct B { B (A a) {} }; int main () { int i = 1; B...

C++
  •  
  • 1545
  • 2

Undefined Behavior and Fermat’s Last Theorem

Written by Tyomitch

In accordance with the C and C++ standards, if the program leads to an integer overflow or any other “undefined behavior” (UB), the result of the program performance can be anything: it can post obscenities to Twitter or format your disk… Unfortunately, “Easter eggs” that would make the program...

C++
  •  
  • 6898
  • 1

Masking a Class in Boost Graph. Part 3: Finding the Path

Written by Vadim Androsov

In the previous articles of the series we’ve reviewed the adaptive process of the square game field for concepts of boost graphs. Now we’ll consider the process of finding the path in the square field. Implementation of boost search allows adapting the algorithm quite accurately. In this article...

C++
  • 1
  • 5000
  • 1

Boost Concepts

Written by Vadim Androsov

I was always scared to use C++ templates due to the absence of standard mechanisms for setting parameter limits. In other words, when a developer writes the following function: template bool someFunc(T t) { if (t.someCheck()) { t.someAction(0); }...

C++
  • 1
  • 4337

Lock-free Stack for Windows

Written by Vengo

It is common practice not to like Windows. But, as a rule, phrase: “I haven't read the book but still condemn it” describes this situation well. Despite the tendency of not like Windows, there are still some things that are implemented well. I’d like to tell you about one of them. I’ll...

C++
  • 2
  • 9610

Ref-qualified member functions

Written by rpz

Today I’m going to tell you about a new and a little known (to my mind) C++ feature — reference-qualified member functions . I’ll tell about the rules of such functions overloading and, as an example of use, I’ll show you that with the help of ref-qualified you can try to improve the resource...

C++
  • 2
  • 4328

Lock-free Data Structures. Memory Model. Part 3.

Written by khizmax

In the previous article we looked inside the processor, even if it’s hypothetic. We have clarified that for the proper parallel code execution we should prompt the processor to what limits he is allowed to execute its internal read/write optimizations. These prompts are memory barriers....

C++
  •  
  • 10268
  • 3