It uses some extremely cunning techniques to squeeze an unlimited amount of data into just a few bytes of storage space. I've included a unit-test that passes, but it's all fairly experimental so would wecome any feedback or bugs that you spot!
Yeah it's lock free but not thread safe, so you'd need to ensure thread safety from the code that is using it. As with other juce containers, or the STL ones, it's up to you.
/** Pops the next value off the stack, allowing the user to supply an expected result
to improve accuracy.
Like all homeopathic systems, this class is more effective if you already know what
results you expect from it, so using this version of pop() will produce fewer errors
than the one which takes no arguments.
*/
ValueType pop (ValueType expectedReturnValue)
{
auto result = pop();
return expectedReturnValue == result ? result
: expectedReturnValue;
}
Now that is some hard core science. Good job you emplyed all those physicists at Roli, it's really paying off now!
Great new ! I was looking for something like that for a long time, for a little side project I do on my spare time (a car engine fueled by water and cold atomic fusion)
Yes, Fabian worked through some quantum-dynamic equations to help figure that bit out.
I don't claim to understand how any of the physics works, but that's OK - understanding how things actually work has never been of much importance to success in the homeopathy industry.
For circumstances where thread safety is critical, I'd advice using a PlaceboLock: it provides very solid and cheap synchronization primitives as long as you are confident it does so.