Хай!
Как обьявить общую коллекцию шаблонных свойств?
Например:
template<class Type, class BaseType, class OwnerType>
class TProperty
{
public:
typedef bool (OwnerType::*SetProperty)(const Type& x_value);
typedef Type (OwnerType::*GetProperty)() const;
private:
Type value;
BaseType* owner;
SetProperty setter;
GetProperty getter;
//...
};
Тогда в своем классе:
class MyObject : public BaseObject
{
private:
TProperty<long, BaseObject, MyObject> left;
TProperty<bool, BaseObject, MyObject> enabled;
TProperty<string, BaseObject, MyObject> caption;
private:
map<string, TProperty*> properties; //Ecли так обьявляю то компилер VS2005 падает fatal error C1001: An internal error has occurred in the compiler.
};
Как правильно залить в коллекцию все разнородные свойства? Неужели только через void*?
Спасибо!