Snippet: Wrapping progmem data

While woking yet another graphics library I came along the problem that I had to use the program memory in order to save precious RAM. Then the code gets a bit messy because you can’t simply dereference the pointers any more. So I came along with a little wrapper class to handle the data in the program memory. It actually works quite well and I did not have to change most of my code I developed on the computer first (due to better debugging tools I had available) which did of course use just RAM.

Therefore I wanted to share it. Maybe someone has use for it.

So when you have a structure in progmem you simply have to wrap its members via the InProgmem class and the wrapper copies the data into RAM when needed.