c++.stlsoft - [COMSTL] interface_cast request
- Pablo Aguilar (35/35) Apr 18 2007 Hi,
Hi, While enjoying my short-lived vacations (4 days =S), I found myself programming with COM *shudder*. I hadn't used ref_ptr + interface_cast, and now that I have, I have to say I really like the way my new code looks. But, as you're probably expecting, there's a couple of issues I ran into, namely: 1) There's interface_cast_addref and there's interface_cast_noaddref. I *think* I understand what to expect from each. But then there's interface_cast with no suffix, and now I'm wondering, what does it do? Maybe it's just the programming-at-3am thing that's getting to me, but... I found it hard to guess =( I'll admit to not having read the help file yet, but still I think there's to fix here. 2) For some reason I can't figure out, IInputObjectSite doesn't have an associated REFIID that __uuidof can retrieve. Thus IID_traits complains when trying to do so. I tried specializing the template, but that didn't seem to work (using Visual Studio 2005, btw), the compiler error remains the same. But even if that had worked, I figured, why not have an optional parameter to give interface_cast the REFIID it needs, at the call site. I agree it's better to have a single place where that's defined and be done with it (i.e. specialize the template, and expect it to work) but the, I'm only using that one interface at one place, so why not have it 'just work'? The one other drawback of the template specialization, is that I have to know the namespace where to put it in. At first I tried comstl, but that's just an alias, so I couldn't do that, then I went on to check the header file, which reminded me of the stlsoft::comstl_project namespace hierarchy, and all that surrounded by conditional compilation directives! It's all good if you're the library writer, but I don't want to have to figure out and repeat the way the library works. After all, I just want a single failing cast to work! =P Hope I made my motivation clear... Thanks!, Pablo P.S. I'd bet you missed my essay-sized posts! ;)
Apr 18 2007