Name: Anonymous 2008-09-26 8:56
1. Time complexity of string::size()? Can't find it anywhere. I'm trying to decide if
int size = string.size()
for(int i(0); i < size; i++)
dostuff();
is less complex than
for(int i(0); i < string.size(); i++)
dostuff();
If it's anything other than constant (ie. a lookup), then doing the latter is really, really bad practise.
2. Is:
this->memberFunction();
an appropriate call for an instance of a self-member in a member def? ie.
int cat::number(int a)
{
if(a < 10)
{
cout << a << endl;
this->number(a++);
}
}
3. hax my anus
int size = string.size()
for(int i(0); i < size; i++)
dostuff();
is less complex than
for(int i(0); i < string.size(); i++)
dostuff();
If it's anything other than constant (ie. a lookup), then doing the latter is really, really bad practise.
2. Is:
this->memberFunction();
an appropriate call for an instance of a self-member in a member def? ie.
int cat::number(int a)
{
if(a < 10)
{
cout << a << endl;
this->number(a++);
}
}
3. hax my anus