[computer-go] C++ pointer question
Peter Drake
drake at lclark.edu
Tue Aug 8 11:54:44 PDT 2006
Okay, I've got this method in my BitBoard class:
void dilate() // Expand to include all adjacent points
{
BitBoard temp;
temp.bits[0] = bits[0] | (bits[0] << 1) | (bits[0] >> 1) | bits[1];
temp.bits[board_width - 1] = bits[board_width - 1] | (bits
[board_width - 1] << 1)
| (bits[board_width - 1] >> 1) | bits[board_width - 2];
for (unsigned row = 1; row < board_width - 1; row++) {
temp.bits[row] = bits[row] | (bits[row] << 1) | (bits[row] >> 1) |
bits[row - 1] | bits[row + 1];
}
for (unsigned row = 0; row < board_width; row++) {
bits[row] = temp.bits[row];
}
}
Is there some way to avoid that second for loop? I tried "this =
temp" and "*this = *temp", but the compiler isn't happy with either.
Thanks,
Peter Drake
Assistant Professor of Computer Science
Lewis & Clark College
http://www.lclark.edu/~drake/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://computer-go.org/pipermail/computer-go/attachments/20060808/2867af44/attachment.htm
More information about the computer-go
mailing list