-Idclass::accessor(bool copy) {\
- if (copy){ \
- accessed_b_ = true;\
- return new Class(* (Class*) data);\
- }else\
- return (Class*) data;\
- }\
-Idclass::~Idclass() { delete accessor(false); }\
-Idclass::Idclass(String s, Class*st, int code):Identifier(s,code) { data = st; }\
-
-
-implement_id_class(Real_id, Real, real);
-implement_id_class(Script_id, Script_def, script);
-implement_id_class(Lookup_id, Lookup, lookup);
-implement_id_class(Symtables_id, Symtables, symtables);
-implement_id_class(Staff_id, Input_staff, staff);
-implement_id_class(M_chord_id, Music_general_chord, mchord);
-implement_id_class(M_voice_id, Music_voice, mvoice);
-implement_id_class(Score_id, Input_score, score);
-implement_id_class(Request_id, Request, request);
-implement_id_class(Input_regs_id, Input_register, iregs);
-
-Identifier::Identifier(Identifier const&)
-{
- assert(false);
+Class ## _identifier::access_content_ ## Class (bool copy_b) const {\
+ ((Class ## _identifier*)this)->accessed_b_ = true;\
+ return copy_b ? new Class (*data_p_) : data_p_;\
+}
+
+#define VIRTUAL_ACCESSOR(Class)\
+Class*\
+Class ## _identifier::access_content_ ## Class (bool copy_b) const{\
+ ((Class ## _identifier*)this)->accessed_b_ = true;\
+ return copy_b ? dynamic_cast<Class*> (data_p_->clone()) : data_p_;\