Hi all. I'm a newbie to this forum so please forgive the odd question as first post... :-)
I'm writing myself a property class (just because I want to play with them). My property header looks something like this (all the usual clutter is removed):
#define property_readwrite( c, v, r, w ) property::property_t <c, v, &c::r, &c::w, (c::v *)0, (c::v *)0>
...
#define property( a, c, v, ... ) property_ ## a( c, v, __VA_ARGS__ )
namespace property {
template<
typename Container,
typename ValueType,
ValueType (Container::*getf)(),
void (Container::*setf)( ValueType value ),
ValueType Container::*getv,
ValueType Container::*setv
>
class property_t {
...
};
...
}
And I use the "property()" template macro thus:
class Person {
private:
unsigned f_age;
void set_age( unsigned new_age );
...
public:
...
property( readwrite, Person, unsigned, f_age, set_age ) age;
};
But the compiler complains that I am only supplying three of the six required template arguments. However, when I use the g++ -E option and look at my code I see:
property::property_t <Person, unsigned, (Person::unsigned *)0, &Person::set_age, &Person::f_age, (Person::unsigned *)0> age;
I've tried both the "property()" macro and the more direct "property_readwrite()" macro and both give the same error. Any idea why I am getting this grief?
Thanks in advance.