To prevent false sharing, I want to align each element of an array to a cache line. So first I need to know the size of a cache line, so I assign each element that amount of
If anyone is curious about how to do this easily in C++, I've built a library with a CacheAligned class which handles determining the cache line size as well as the alignment for your T object, referenced by calling .Ref() on your CacheAligned object. You can also use Aligned if you know the cache line size beforehand, or just want to stick with the very common value of 64 (bytes).
https://github.com/NickStrupat/Aligned