I have an int which I have encapsulated as a 'property' using the template solution here:
https://stackoverflow.com/a/4225302/3717478
template<typename T>
class Property
{
protected:
T& _value;
public:
Property(T& value) : _value(value)
{
} // eo ctor
Property<T>& operator = (const T& val)
{
_value = val;
return *this;
}; // eo operator =
operator const T&() const
{
return _value;
}; // eo operator ()
T& operator() ()
{
return _value;
}
T const& operator() () const
{
return _value;
}
};
However if the property identifier is passed as an argument to a function expecting a variable number of arguments, such as printf(), the class pointer value is passed instead of the int value.
Is there an operator that I can overload so that the int value is passed instead?