C++ class data in flash

Can I put all of a C++ class in flash, if none of the data elements are modified at runtime? (It seems unlikely to be supported by the compiler, I guess: it would have to understand when to use normal memory accesses and when to use pgmspace. Perhaps the latest version can do this?)

Can I put ANY of a class's data into flash instead of RAM?


All class/struct/union data in flash:

struct Foo{
  int a;
  bool b;
  float c;

Foo f PROGMEM = { 1234, true, 3.14f };

//Access members using their address.
pgm_read_word( &f.a );
pgm_read_byte( &f.b );
pgm_read_dword( &f.c );

For individual elements, use static members.

struct Foo{
  int a;
  bool b;
  static float c;

float Foo::c PROGMEM = 3.14f;
Foo f = { 1234, true };

float temp = ( float ) pgm_read_dword( &f.c );

This is the most basic way, and is really no different to using primitives in PROGMEM.
You can even design your class so you can use it as normal and hide the PGM functionality in the background. Which may be closer to what you where imagining.