This project is intended to be a collection of random working things that I’ve made. Everything here has a its own source file, as well as test source code to show it working. Everything is tested on a x64 machine running Arch Linux (I’ll probably eventually get around to doing other platforms as well).
rptr is an implementation of a relative pointer using a template class.
The advantage of using rptr over a standard pointer is that the memory usage is constrained to less than a standard pointer (8 bytes for a pointer on x64). This comes at the cost of limited relative memory that can be pointed to by the pointer, however it is still substantial (about 2gb for an int).
This is particularly helpful for data structures that contain a pointer to something else. A struct containing an int and a pointer is 16 bytes on x64 (4 bytes for the int, 8 for the pointer and 4 bytes of padding because of alignment), whereas a struct containing an int and a rptr<int> is only 8 bytes (4 bytes for the int, 4 bytes for the rptr<int>. rptr<short> or rptr<char> do not save any space because of alignment).
buffer is an implementation of a byte array to store a set amount of memory and save on allocation time. It includes features to save and read the memory from a file (though it does this 1 to 1 at the moment, so a 2gb buffer will write a 2gb file).
I wrote this class to use in a future memory manager.
A collection of other things that I made that don’t really have a purpose.