On Sunday, 10 June 2012 at 10:23:09 UTC, Timon Gehr wrote:
No there is not. You could use a template that calls a private
function at compile time instead. What is your use case?
I was just thinking about a situation where a property
accessor/mutator methods are not as simple as read/assign value,
such as in this silly example:
struct Flipping123
{
private int m_number = 123;
@property bool isPositive()
{
return m_number >= 0;
}
@property void isPositive(bool b)
{
m_number = b ? 123 : -123;
}
}
//...
Flipping123 fl;
fl.isPositive = false; // I'd rather not have cond. branching
in release mode