Re: sorting 5million minute data: choose std::list or std::vector
On Feb 15, 12:37 pm, Leigh Johnston <le...@i42.co.uk> wrote:
On 15/02/2011 11:14, James Kanze wrote:
On Feb 15, 12:15 am, Leigh Johnston<le...@i42.co.uk> wrote:
On 14/02/2011 22:38, Ian Collins wrote:
[...]
People in the "use int everywhere" camp are lazy fuckers who no doubt
prefer "int" because it only involves typing 3 characters .. oh no teh
source codez doesn't fit in my editor windowz.. must use "int".
One can see the level of your communication skills. Personally,
I don't think people like Stroustrup are "lazy fuckers".
The language designers intended for int to be used everywhere,
unless special considerations dictated otherwise. If you have
some concrete arguments as to why this situation has changed,
present them. But just calling the language designers "lazy
fuckers" isn't much of an argument.
What you fail to appreciate is that using types other than "int" are not
"special" cases; the language designers intended for all C++'s built-in
types to be used.
You must be one of the lazy fuckers.
/Leigh
/*
* The following code snippets are presented for Leigh's assesment
* whoever wrote clearly has no idea that the C++ language designers
* did not intend int to be used liberally for array indexing
*
* I should imagine the author is a lazy <expletive deleted as its
* neither big nor clever> and also a troll. I will try and get
* Bjarne to chastise them, and deprecate the book from which they
* are extracted
*/
void another_function ()
{
int v1[10];
int v2[10];
for(int i =0; i<10; ++i ) v1[i]=v2[i];
}
namespace Stack { //representation
const int max_size=200;
struct Rep{
char v[max_size];
int top;
};
const int max=16; //maximumnumberofstacks
Rep stacks[max]; //preallocatedstackrepresentations
bool used[max]; //used[i] is true if stacks[i] is inuse
}
void rotate_all (vector <Shape *>& v ,int angle) // rotate v's
elements angle degrees
{
for (int i=0;i<v.size();++i) v[i] -> rotate(angle);
}
struct Entry {
string name ;
int number;
};
Entry phone_book[1000];
void print_entry (int i ) // simple use
{
cout << phone_book[i].name << ' ' << phone_book[i].number << '\n';
}