I use template joins to assure myself that I always get a 64-bit field for pointers (even on 32-bit machines, because data is being transferred to a 64-bit machine) and to save both the user and me.
template <typename type> union lrbPointer
{
uint64_t intForm;
type ptrForm;
};
lrbPointer<int*> myPointer;
int integers[4];
myPointer.ptrForm = integers;
myPointer.intForm += 2;
this works well for me, but I'd love to find a way to make the default member. so the user does not need to use .ptrForm after the pointer that they want to use.
source
share