> No wanting to sound patronising, but it's just a matter of practice. As
> as you realise the huge benefits Teampltes give you, you'll never stop
> using them. However, it is possible to over use them.

Yes, I do realise that practice will improve how it looks, but just on a
purely "first impressions" basis, since it means adding extra words to a
normal declaration it can get rather wordy, and the angle brackets,
especially when nested, are hard to follow (especially since they are also
used for less than / greater than, and bit shifts).

I actually used a template once, successfully - the code ended up being
rewritten in the end without them, but I did get them working - I actually
had a good use for it!

>
> > > >  class COMInit
> > >  {
> > >   COMInit() { CoInitialize( NULL ); }
> > >   ~COMInit() { CoUninitialize(); }
> > >  } const g_init;
> >
> > Interesting way of doing it.
>
> How else would you do it? :-)

Call one in InitInstance() and the other in ExitInstance() {:v)

> I wouldn't do it quite the same way as Ehsan, unless of course the
> above is a class dcalred and defined local to main?

I assumed it was used as a global object? I must admit I've never declared
classes with that extra bit, but doesn't g_init become a global instance of
the COMInit class? There's just so much to the C++ language, so many ways of
doing things, it's mind-boggling {:v)

~They're messing with your head Jason, ignore them!~
*plods off to his VERY basic MFC coding*

--
Jason Teagle
[EMAIL PROTECTED]




Reply via email to