6 private links
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()
);
Clean Thesis is a clean, simple, and elegant LaTeX style for thesis documents.
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.
So what does this have to do with make_shared? An std::shared_ptr is a relatively complex beast that has to do atomic reference counting and efficient destruction dispatching and things like that. As such, a relatively large amount of code is instantiated for each std::shared_ptr<> type.
Implementing f() to make the following snippet compile without the static_assert being fired looks impossible, doesn't it?
// <insert solution here>
int main () {
constexpr int a = f ();
constexpr int b = f ();
static_assert (a != b, "fail");
}
This post walks through a complete, compile time implementation of a Snake game using C++ template metaprogramming.
This is an advanced blog post more geared to library writers who want to improve error messages due to substitution failure. It discuss how substitution failures can be transported so the correct information can be presented to the user. Lets first look at the problem.
A dependent type is a type that has a dependency on a value. It essentially is way to encode values into the type, that is, every value has a unique type. Non-type template parameters in C++ allow this. Also, std::integral_constant is good example of dependent typing.
One of the new features in C++11 aimed at increased code efficiency is the emplace family of methods in containers. std::vector, for example, has an emplace_back method to parallel push_back, and emplace to parallel insert.
In this post we will learn C++ templates in depth: Class and function templates, template parameters, variadic templates, all with in depth examples.
Some beautiful template for static html5 site