
I do apologize if this is all plainly obvious to some people, but I'm having difficulty getting it through my thick skull.
// simple example struct property_holder_base { virtual ~property_holder_base() {} }; template<class m_class, class m_type> struct get_member_property_holder { typedef ... func; get_member_propert_holder(func f) : f(f) {} func f; }; template<class m_class, class m_type> struct set_member_property_holder { typedef ... func; set_member_propert_holder(func f) : f(f) {} func f; }; struct reflected_property { // templated constructor template<class m_class, class m_type> reflected_property( m_type (m_class::*getter)() const, void (m_class::*setter)(m_type), const std::string & name) { s_getters[name] = ptr(new ...(getter)); s_setters[name] = ptr(new ...(setter)); } typedef boost::shared_ptr<property_holder_base> ptr; static std::map<std::string,ptr> s_getters; static std::map<std::string,ptr> s_setters; }; struct window { bool is_enabled() const; void enable(bool); }; // define a global static namespace { reflected_property r(&window::is_enabled,&window::enable,"window::enabled"); } Best, John -- John Torjo, Contributing editor, C/C++ Users Journal -- "Win32 GUI Generics" -- generics & GUI do mix, after all -- http://www.torjo.com/win32gui/ -- v1.5 - tooltips at your fingertips (work for menus too!) + bitmap buttons (work for MessageBox too!) + tab dialogs, hyper links, lite html