making a fast string class

Started by
3 comments, last by The Alchemist 21 years, 5 months ago
i just made a string class and it is pretty much a excapsulament of a dynamic string, altering basicly is deleting the actual string in the memory and allocating a new one with the new size... and is slow as a hell i tought chaging it by making it a block based string,so everytime that the string grows besides its default size it allocs another block( each block will be a fixed ammount of chars), thats would significantly reduce the ammount of news but is still not fast enough so i kinda ran off ideas any sugestions for a fast string class? ------------------------------- MOTHERSHIP!!! hahaha! very funny! now take me outta here!!!!!
"Everything works out in the end, if it doesn't then it is not the end"
Advertisement

    #include <string>std::string anyString;  


[edited by - MadKeithV on October 22, 2002 7:17:17 AM]
It's only funny 'till someone gets hurt.And then it's just hilarious.Unless it's you.
Any attempt to come up with a fast string class should be preceded by:

a) learning what''s already available;
b) going to the Google archives of comp.lang.c++ and searching for "Peter Olcott".
http://www.cuj.com/experts/1906/alexandr.htm?topic=experts
quote:Original post by SabreMan
b) going to the Google archives of comp.lang.c++ and searching for "Peter Olcott".


And a few hours to read the thousands of posts he prompted....
char a[99999],*p=a;int main(int c,char**V){char*v=c>0?1[V]:(char*)V;if(c>=0)for(;*v&&93!=*v;){62==*v&&++p||60==*v&&--p||43==*v&&++*p||45==*v&&--*p||44==*v&&(*p=getchar())||46==*v&&putchar(*p)||91==*v&&(*p&&main(0,(char**)(--v+2))||(v=(char*)main(-1,(char**)++v)-1));++v;}else for(c=1;c;c+=(91==*v)-(93==*v),++v);return(int)v;}  /*** drpizza@battleaxe.net ***/

This topic is closed to new replies.

Advertisement