6 private links
Any piece of code we write has one of four levels of exception safety: No guarantee, the basic guarantee, the strong guarantee anf the nothrow guarantee. Let’s consider them one by one.
This tip presents a intrusive custom RTTI class which provides better performance than dynamic_cast.
Writing code for multiple platforms can be a lot of work. It can be even more work to have to completely rewrite it for each one, too. What if you wrote an application in C++, but wanted it to be displayed in the browser somehow? Well now, with a tool called Emscripten, that’s possible.
As you might be aware, C++ doesn't excel when it comes to examine the type or properties of an object at runtime. The best ability provided by default would be RTTI. Not only RTTI isn't always available, but it also gives you barely more than the current type of the manipulated object. Dynamic languages or those having reflection on the other hand are really convenient in some situations like serialization.
Asm<int>(
MOV(ecx, 5_d),
MOV(eax, 0_d),
"start"_label,
CMP(ecx, 0_d),
JE("done"_rel8),
ADD(eax, 6_d),
DEC(ecx),
JMP("start"_rel8),
"done"_label,
RET()
);
The idea behind dependency injection really is quite simple. You have a bunch of objects (I'll refer to them as "services"), some of which depend on the others. Each service explicitly declares its dependencies in some way (for example, by listing them as parameters to its constructor). An external piece of code (the so-called injector) creates and provides the dependencies accordingly, based on these declarations. This is a nice improvement over having everything be a singleton or passing around a huge service locator.
Yield in c++
Concepts and the related notion of axioms were an extension to C++'s template system proposed for C++11. They were designed to improve compiler diagnostics and to allow programmers to codify in the program some formal properties of templates that they write. Incorporating these limited formal specifications into the program (in addition to improving code clarity) can guide some compiler optimizations, and can potentially help improve program reliability through the use of formal verification tools to check that the implementation and specification actually match.