If a sliding window is needed, shift and push might be better.This leads to extra memmove()s if you're lucky (I believe Perl does this), and endless memory consumption otherwise. If you use the mod operator when indexing your array, you get a ring buffer without excess copying. You could probably abstract this out nicely with a bit of extra work.
In reply to Re^4: how to read multiple line from a file
by educated_foo
in thread how to read multiple line from a file
by skyworld_chen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |