
AMDG Brian Davis wrote:
I am only providing a simple example for discussion and hopefull inclusion of data binding concept in boost and ....ultimately modify the C++ compiler to provide for a lighter weight solution (events based on modifications of integral types) - Ouch ... yes I know what I am asking here... see the last part of the example output for why I ask this.
What exactly do you mean by a lighter weight solution? Allowing events to be registered for an arbitrary int would have the following consequences: The compiler would have to insert extra code for every integer assignment, severely degrading performance regardless of whether this feature is used--except where the compiler can prove that no event is registered for a particular integer. The function f(int& i) { i = 0; } could throw. This would break a lot of exception safety guarantees. Every assignment could modify any variable, effectively forbidding many compiler optimizations based on pointer alias analysis. In Christ, Steven Watanabe