in reply to Perl and C++/STL
The moral of the story is that once your problem becomes large enough, asymptotic algorithm performance dominates the constant factors separating a "slow" language from a "fast" one.
Update:
As for your pre-allocation concerns with std::vector, there's good news. You will indeed get segfaults using the square-bracket notation for entries that don't exist (vector<int> a(1); cout << a[3];), but the .at() accessor performs the equivalent function after doing a bounds check (it throws an exception if you violate the bounds instead of segfaulting). And if you find yourself needing to increase the size of the vector, the .resize() method does just that for whatever size you need.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Perl and C++/STL
by rg0now (Chaplain) on Mar 11, 2005 at 11:08 UTC |