
Yes it is an interesting "hack".How "pretend" have you been able to make this?
I was actually thinking about exactly this today (long drive - actually - correction - I was thinking about it yesterday - it's now early morning here) and wondering what the consequences were. Does it result in actually default constructing all these (temporary) objects? Won't that be expensive and/or have undesirable side effects?
This is actually what I find so cool with the typeof feature (is it too late to donate a kidney for it? ;-) ). We are calling constructors and lots of operators and it costs nothing run-time because typeof only evaluate the return value of build_stt(...). So no call actually happens. All what you have really is a typedef. The only side effect (besides compiler support) is that you need an empty constructor or would be forced to pass some dummy value.
participants (1)
-
Christophe Henry