You could create a new class ProgmemMemberType
and define some assignment operators to convert between memory spaces.
const MemberType &MemberType::operator=(const ProgmemMemberType &other)
{
memcpy_P(this,
other.progMemPointer(),
sizeof(MemberType));
return *this;
}
const ProgmemMemberType &ProgmemMemberType::operator=(const MemberType &other)
{
// Whatever the reverse of memcpy_P is...
return *this;
}
Then you can write MemberType member = object->member
or object->member = member
and the assignment operator will do the work.
This is the cleanest solution I can think of; the ->
operator is not really meant for this kind of thing.
And of course if you don't want to define a new wrapper class for every type you use, you can use a template class.