Hey Sorry for late reply thanks for clearing alot of stuff up there for me! I have a branch on launchpad i work at on the weekend :)
https://code.launchpad.net/~herron-philip Its ok so far but i am havin the problems where stuff in storage/heap/*.c are trying to call the LIST stuff and because its STL LIST at the moment. I am having problems to get them to compile against this. But yeah i had to change a few files so far but if you say you would prefer to have just a more standard stl::vector through instead of having the custom LIST stuff i could change it for that. -Phil http://redbrain.co.uk 2009/1/20 Jay Pipes <[email protected]> > Philip Herron wrote: > >> Hey >> >> Just starting to look at doing this replacement. And thinking this could >> change alot if we move to vector.h >> >> I see in mysys/my_list.h && mysys/list.cc >> >> The List is treated like a stack as: >> LIST *list_add(LIST *root, LIST *element) >> { >> if (root) >> { >> if (root->prev) /* If add in mid of list */ >> root->prev->next= element; >> element->prev=root->prev; >> root->prev=element; >> } >> else >> element->prev=0; >> element->next=root; >> return(element); /* New root */ >> } >> >> I see we return element the thing you want to add as the new root of the >> LIST and root becomes the next link. So does this mean you treat the list >> more like a stack? like stack.push? >> >> So like i started with like to see if i could make a little changes to the >> code with: >> >> typedef vector<void*> LIST; >> >> And then just work things around it. But playing around with vector: >> vector<const void*> mylist; >> >> //would be like list_add(LIST,item) >> mylist.push_back("test"); >> mylist.push_back("test2"); >> > > yep. > > int i; >> for(i=0;i<mylist.size(); ++i) >> printf("vector: %i - %s\n",i, (char*)mylist[i]) >> > > Actually, a more standard way of doing it would be: > > vector<const char *> mylist; > vector<const char *>::const_iterator current= mylist.begin(); > uint32_t x= 0; > > mylist.push_back("test1"); > mylist.push_back("test2"); > > while (current != mylist.end()) > printf("vector: %i - %s\n", x++, *current); > > >> I dont see a vector.push but just vector.push_back(). >> > > Correct. > > So this could mess up everyones code. >> > > Don't really care about that. :) If we can get to a more standard, less > custom code base, more people can contribute without the heavy overhead of > having to understand yet-another-custom-list-class. > > > But if i use stl stack it works > >> but it isnt so easy to access the members of the vector because you have >> to just pop() them and you dont get them back as it doesnt return anything. >> >> stack<const void*> list; >> list.push("first"); >> list.push("second"); >> list.push("third"); >> >> printf("Stack size: %i\n",list.size()); >> while( !list.empty() ) { >> printf("Stack %s\n",(char*) list.top()); >> list.pop(); >> } >> >> But i guess if you used vector, but just reversed it each time. It maby be >> ok but just could be slower? Hmm i am not 100% sure if i got this all right. >> I usualy just make my own structs :) in c so i dont use the container >> classes in c++ that often >> > > Vector is more powerful than stack, but both could be used at varying > places in the code. The huge advantage, IMHO, to getting rid of the custom > list classes is that STL container classes are fully compatible with > <algorithm>, which would simplify a ton of code. > > That and see point above... > > Just wondering what do you recomend i do? >> > > There's no reason to stick with just vector. Different code needs > different containers. Investigate <vector>, <list>, <map>, <queue> and > <deque> for starters... > > cheers, > > jay > > -Phil >> http://redbrain.co.uk >> >> _______________________________________________ >> Mailing list: >> https://launchpad.net/~drizzle-discuss<https://launchpad.net/%7Edrizzle-discuss> >> Post to : [email protected] >> Unsubscribe : >> https://launchpad.net/~drizzle-discuss<https://launchpad.net/%7Edrizzle-discuss> >> More help : https://help.launchpad.net/ListHelp >> > >
_______________________________________________ Mailing list: https://launchpad.net/~drizzle-discuss Post to : [email protected] Unsubscribe : https://launchpad.net/~drizzle-discuss More help : https://help.launchpad.net/ListHelp

