Difference between stack-allocated class and struct
Sean Cavanaugh
WorksOnMyMachine at gmail.com
Mon May 2 23:41:31 PDT 2011
Here is my prototype COM compile-time reflection based wrapper mixin
(which I have abandoned in favor of alias this since it covers 95% of my
use cases even though it isn't perfectly safe). I am new at D so you
have been warned, though this part of the language seems pretty
straightforward enough. It is possible the track down the argument
names but takes some rather intricate parsing to do correctly (and the
example someone linked me in another thread of mine chocked on const
types due to parsing bugs).
http://snipt.org/xsu
The wrapped interface also needs to be a mixin so it can be created in
the correct module, with visibility to all the types passed to the
interface's methods.
So something like the following is going to fail miserably unless ComPtr
is also made into a mixin and instantiated in the correct module.
struct ComPtr(T)
{
public:
T m_Pointer;
mixin(WrapComInterface!(T)("m_Pointer")
};
More information about the Digitalmars-d-learn
mailing list