Compact offset pointer, existing implementations?

Is there a template in stl, boost, or other LGPL open source toolkit that behaves exactly like this: -
- a relative pointer with user alignment, the ability to store fewer bits to reduce the range. possible implementation to illustrate: -

template<typename T, typename OFFSET=int, 
    int ALIGN_SHIFT=2>
class   OffsetPtr 
{
    OFFSET  ofs;

public:
    T* operator->() {
        return  (T*) (((((size_t)this)>>ALIGN_SHIFT)+ofs)<<ALIGN_SHIFT);
    };
    void operator=(T* src) {
        size_t ofs_shifted = (((size_t) src)>>ALIGN_SHIFT) - (((size_t) this)>>ALIGN_SHIFT); //asserts..
        ofs = (OFFSET) (ofs_shifted);
    }
    //...
};

This is what I usually created in the past (compact, precompiled data). for data broken into sub 128k fragments OFFSET = short
Another option that I would use in ancient C # defines would be to use offsets from the header, where alignments would be more useful.

- " interprocess" boost, "offset_ptr", , , , - , . , , stl- , - " " 16- 16 ,

+5
1

Visual ++, __based .

+2

All Articles