F
freckred76
Hi,
I think this might be a VC++ problem. I am using Microsoft Visual
Studio 2005 Full Version (8.0).
I have a simple for loop that iterates over a list using the standard
iterator. The list is populated with a struct _BLOCK defined as:
typedef struct
{
int iX ;
int iY ;
int iFrame ;
double dIntensity ;
} _BLOCK ;
std::list<_BLOCK> list_block;
std::list<_BLOCK>::iterator list_block_it;
for (list_block_it = list_block.begin (); list_block_it !=
list_block.end (); list_block_it++)
{
list_block_it->dIntensity -= 0.025 ;
if (list_block_it->dIntensity < 0.0)
{ // Delete this item
list_block_it = list_block.erase (list_block_it);
}
}
The code seems fine to me, but it always fails an assert at run-time,
claiming "list iterator not incrementable." I haven't been able to
find any documentation or threads about this problem. Also, it seems
like this code runs fine when built with g++ or previous versions of
VC++.
Any help is greatly appreciated,
Nate
I think this might be a VC++ problem. I am using Microsoft Visual
Studio 2005 Full Version (8.0).
I have a simple for loop that iterates over a list using the standard
iterator. The list is populated with a struct _BLOCK defined as:
typedef struct
{
int iX ;
int iY ;
int iFrame ;
double dIntensity ;
} _BLOCK ;
std::list<_BLOCK> list_block;
std::list<_BLOCK>::iterator list_block_it;
for (list_block_it = list_block.begin (); list_block_it !=
list_block.end (); list_block_it++)
{
list_block_it->dIntensity -= 0.025 ;
if (list_block_it->dIntensity < 0.0)
{ // Delete this item
list_block_it = list_block.erase (list_block_it);
}
}
The code seems fine to me, but it always fails an assert at run-time,
claiming "list iterator not incrementable." I haven't been able to
find any documentation or threads about this problem. Also, it seems
like this code runs fine when built with g++ or previous versions of
VC++.
Any help is greatly appreciated,
Nate