Re: C++ 'map' needed


Subject: Re: C++ 'map' needed
From: Vlad Harchev (hvv@hippo.ru)
Date: Mon Nov 27 2000 - 03:31:51 CST


On Mon, 27 Nov 2000, Mike Nordell wrote:

> >> What I really need is something equal to
> >> typedef std::map<std::string, HBITMAP> Win32ToolbarIcons;
> >
> > To the best of my knowledge, no such structure exists. How badly do
> > you need it?
>
> How about "badly"? :-) (IMHO)
>
> It's IMHO vital to release resouces when cleaning up.
>
> It's not really harming (in reality), the OS does clean these resources up
> when terminating the process, but we still "leak" them. Is that an option?
> I'd say not. I'd aim for a "clean".

 Personally I wouldn't bother with this. But if you need map, I would
recommend the very very hackish way:
        UT_Pair
in order to allow the use of HBITMAP as 'value', sprintf(buf,"%x",handle) it
(to get string representation) and then, at exit, do sscanf(buf,'%x",&handle)
to get the original value of handle.

 IMO it's rather reasonable to use this apporach, especially since performance
is not an issue in your case.
 Of course moving to STL is much better solution - but it seems we can't
afford it.
 
> /Mike- please don't cc
>

 Best regards,
  -Vlad



This archive was generated by hypermail 2b25 : Mon Nov 27 2000 - 03:54:13 CST