Re: Keeping STL Containers in scope in Win32 C++
- From: brianushman@xxxxxxxxx
- Date: 9 Aug 2006 07:00:34 -0700
Jerry,
Thanks for the reply, I actually did use the iterator method but I
forgot to type it in my post (which I guess doesn't help much when i'm
asking for help). Nevertheless, I tried your method for isolating the
problem in a sample program and I have it working so it looks like
there is something wrong with my program so I will start to
investigate.
Thanks for the tips, it's much appreicated!
Jerry Coffin wrote:
In article <1155094762.801589.35640@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
brianushman@xxxxxxxxx says...
[ ... ]
list<int> MyListIterator;
I haven't looked carefully at the rest of your code, but one way or
another, this looks like a problem. If you really want an iterator, you
need to do something like:
list<int>::iterator MyListIterator;
WinMain(...)
{
MyList.push_front(2);
}
WinProc(...)
{
// At this point the only integer in the list has become
unitialized, however when I view it
// in the message loop in WinMain the value is valid.
MyListIterator = MyList.begin();
Okay -- as it stands, this shouldn't compile. A few obvious things:
first of all, have you checked that the initilization code in WinMain
has actually executed _before_ you try to look at it in WndProc? Given
the asynchronous nature of WndProc's, it's easy to get things out of
order between the two.
The usual advice applies here: narrow your code down to the smallest you
can that still compiles and still shows the problem. Then cut and paste
that code into your request for help (do NOT re-type it, or we'll almost
inevitably end up with problems like above that prevent the code from
compiling).
--
Later,
Jerry.
The universe is a figment of its own imagination.
.
- References:
- Keeping STL Containers in scope in Win32 C++
- From: brianushman
- Re: Keeping STL Containers in scope in Win32 C++
- From: Jerry Coffin
- Keeping STL Containers in scope in Win32 C++
- Prev by Date: Re: Keeping STL Containers in scope in Win32 C++
- Next by Date: string memory leak?
- Previous by thread: Re: Keeping STL Containers in scope in Win32 C++
- Next by thread: string memory leak?
- Index(es):