Division By Zero Exploration pt 2

This is a continuation of an earlier post called, Division By Zero Exploration, which was a continuation of an even earlier post, Division By Zero. In the exploration post, I concluded that, if dividing by zero is valid, then, “it is basically possible to make anything equal anything”. Further thought has lead to an additionalContinue reading “Division By Zero Exploration pt 2”

Structured Bindings and replacing by reference

C++ 17 has Structured Bindings, what they do is create a temporary object and provide access to the object’s members locally. What happens is we create a temporary S object, and then copy the values memberwise into the binding structure. x now equals 5 and b equals 3.2. the S instance goes away. Since functionsContinue reading “Structured Bindings and replacing by reference”

Asymptotic Movement

I discovered a GDC talk on a topic called: Asymptotic Averaging. This is sort of a form of interpolation, and can be used to eliminate jerky motions – in particular, they focus on camera movement. Naturally, when you want to change a camera’s direction, you just set the direction. However, if you are doing thisContinue reading “Asymptotic Movement”

Fold Expressions and Lamda Overloads

C++17 has a powerful template feature – Fold Expressions – that combines with a C++11 feature – Parameter Pack. This allows us to do away with C-style variable arguments (variadic functions). I introduce Lamda Overloading as well, to work with these two concepts in a wonderful way. First off, the Parameter Pack. This is aContinue reading “Fold Expressions and Lamda Overloads”

Division By Zero Exploration

This post isn’t so much about programming as much about an earlier post about Division By Zero. So, I thought, if the reciprocal operation to 1 / 0, 0 / 1, is valid, then maybe division by zero can be postponed and considered later. Similar to the imaginary concept, i or sqrt(-1). Using just fractionContinue reading “Division By Zero Exploration”

Super Simple Lambda Thread Pool

I wanted to quickly create a thread pooler that could be passed lamdas. Turns out it’s super simple. Here are the main things I wanted to accomplish: pass lamdas as tasks to be executed asap. be able to wait for all tasks to execute create a bunch of threads at initialization and them have thenContinue reading “Super Simple Lambda Thread Pool”

C++ lambda and how the world is different now

So, there was the world of C++ before the lambda. And now there’s the world of C++ since the lambda – and I’ve got to say, if you aren’t using lamdas, then your’e probably still in the C++ stone age. This post is going to be all about lamdas and how rad they are. DoContinue reading “C++ lambda and how the world is different now”

Going Faster With Alignment

So, in the previous post I talked about, fast_remove_if, and going faster than the std::remove_if function. Now there is a further improvement that can be made to go *even* faster, but with no need to modify any functions – instead it involves modifying the alignment of the data in the vector. Here’s the object weContinue reading “Going Faster With Alignment”

fast_remove_if

So you may know about the “erase, remove_if” method of removing elements from a vector. Looks like this: This operation is an order-preserving operation, and “slow” if we don’t care about preserving the order. To remove stuff from an array quick, without preserving the order, you may have heard of something called, swap-remove. That’s whenContinue reading “fast_remove_if”