| re: Sizing a vector of vectors
"cheeser" <cheeser_1998@yahoo.com> wrote in message
news:vTHdb.3206$La.1055@fed1read02...[color=blue]
>
> Hello,
>
> I'm trying to size a vector of vectors of unsigned ints to be an NxN[/color]
square.[color=blue]
> Here's how I'm doing it:
>
>
>
> typedef vector<vector<unsigned int> > tournament_type;
>
> unsigned int n;
> tournament_type tournament;
>
> // Go get a value for n...
>
> tournament.resize(n);
>
> for_each(
> tournament.begin(),
> tournament.end(),
> bind2nd(mem_fun1(&tournament_type::value_type::res ize), n)
> );
>
>
>
> On the platform I'm on (VC++ 7.1), I get an internal compiler error.[/color]
Before[color=blue]
> I go over to the VC++ group, I'd like to make sure this code should indeed
> compile. Can anybody see any syntactical or semantic errors that I have
> made? Or is it OK, indicating a true compiler problem?
>
> Thanks,
> Dave
>
>[/color]
An update to my earlier post:
Actually, I think this is the way it should be done:
for_each(
tournament.begin(),
tournament.end(),
bind2nd(mem_fun_ref(&tournament_type::value_type:: resize), n)
);
The reference I have has a typo I believe. However, I still get an internal
error on VC++ 7.1 whereas it works under g++.
I'm sure someone will point out that an internal error is a problem in any
case, and they're right. I'll pass this on to MSFT. Even if there is a
legitimate problem in the code, internal error is not the proper response...
However, I'd still like to get confirmation from some of the gurus out there
that what I've done is correct according to the standard...
Thanks again,
Dave |