Question of the day....
-
Nish - Native CPian wrote: Man!!! You Aussies sure know how to be sarcastic! Did Chris say something sarcastic ? :P Christian I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Christian Graus wrote: Did Chris say something sarcastic ? Ouch!!! A sub-joke! Wise guy!!! :-D
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Buy it, read it and admire me :-)
-
Chris Maunder wrote: We've got VB.NET, C#, ASP, javascript, plain vanilla C and even an article on Forth True, there are nine articles on VB.NET. There are more than that on OpenGL ( being the most off topic thing I could see on the list ), so are we going to see some OpenGL questions ? Christian I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
So send me some STL questions then. cheers, Chris Maunder
-
Why am I being asked about VB.NET operators on a C++ programming website ? I wouldn't mind if it was C#, but surely only a very small number of us are afflicted with VB, and VB.NET even less so ? Christian I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
-
David Wengier wrote: Why does it worry you that there exists such a language? I don't care that it exists at all. I'd just prefer not to be reminded of it :-) Christian I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
-
Chris Maunder wrote: So send me some STL questions then. Q: How would you write a
strtok()
equivalent using thestring
methods? Mail your responses to Mike Dunn (preferably by tomorrow, not that he has a deadline then or anything). --Mike-- Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines! My really out-of-date homepage Sonork-100.19012 Acid_HelmUsing ONLY the methods in std::string, or also using the algorithms provided by the STL ? Christian I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
-
So send me some STL questions then. cheers, Chris Maunder
Chris Maunder wrote: So send me some STL questions then. Q: How would you write a
strtok()
equivalent using thestring
methods? Mail your responses to Mike Dunn (preferably by tomorrow, not that he has a deadline then or anything). --Mike-- Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines! My really out-of-date homepage Sonork-100.19012 Acid_Helm -
So send me some STL questions then. cheers, Chris Maunder
Chris Maunder wrote: So send me some STL questions then. Am I REALLY that belligerent about STL ? :P I will send you something probably tonight. Christian I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
-
You do realise that the whole .NET thing is merely a ploy to get people to move from C++ to C#, onto VB.NET and then to the one true language: VBScript. You will be assimilated. cheers, Chris Maunder
Well, I use C++ and VBScript already, so can I skip the VB.NET part ? :-) Christian I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
-
Using ONLY the methods in std::string, or also using the algorithms provided by the STL ? Christian I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Algorithms are acceptable too :) --Mike-- Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines! My really out-of-date homepage Sonork-100.19012 Acid_Helm
-
David Wengier wrote: Why does it worry you that there exists such a language? I don't care that it exists at all. I'd just prefer not to be reminded of it :-) Christian I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
You do realise that the whole .NET thing is merely a ploy to get people to move from C++ to C#, onto VB.NET and then to the one true language: VBScript. You will be assimilated. cheers, Chris Maunder
-
Chris Maunder wrote: We've got VB.NET, C#, ASP, javascript, plain vanilla C and even an article on Forth True, there are nine articles on VB.NET. There are more than that on OpenGL ( being the most off topic thing I could see on the list ), so are we going to see some OpenGL questions ? Christian I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
-
Chris Maunder wrote: So send me some STL questions then. Q: How would you write a
strtok()
equivalent using thestring
methods? Mail your responses to Mike Dunn (preferably by tomorrow, not that he has a deadline then or anything). --Mike-- Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines! My really out-of-date homepage Sonork-100.19012 Acid_HelmFollowing code I am using. It's a modificated version of http://gcc.gnu.org/onlinedocs/libstdc++/21_strings/stringtok_std_h.txt [Paul]
template <typename outit>
void tokenize (outit x, const std::tstring &in, const TCHAR * delimiters = _T(" \t\n"))
{
const std::tstring::size_type len = in.length();
std::tstring::size_type i = 0;while ( i < len ) { // eat leading whitespace i = in.find\_first\_not\_of (delimiters, i); if (i == std::tstring::npos) return; // nothing left but white space // find the end of the token std::tstring::size\_type j = in.find\_first\_of (delimiters, i); // push token if (j == std::tstring::npos) { \*x = in.substr(i); ++x; return; } else { \*x = in.substr(i, j-i); ++x; } // set up for next loop i = j + 1; }
}
Example:
std::liststd::string ls;
utl::tokenize (std::back_inserter(ls), " this \t is\t\n a test ");
for (std::list::const_iterator it = ls.begin(); it != ls.end(); ++it)
{
std::cerr << ':' << (*it) << ":\n";
}would produce following output:
:this:
:is:
:a:
:test:Regards Thomas Sonork id: 100.10453 Thömmi
Disclaimer:
Because of heavy processing requirements, we are currently using some of your unused brain capacity for backup processing. Please ignore any hallucinations, voices or unusual dreams you may experience. Please avoid concentration-intensive tasks until further notice. Thank you. -
Why am I being asked about VB.NET operators on a C++ programming website ? I wouldn't mind if it was C#, but surely only a very small number of us are afflicted with VB, and VB.NET even less so ? Christian I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Do you fancy coming up with a few lint-type questions? [what do you do if you have an inny type button] Alice thought that running very fast for a long time would get you to somewhere else. " A very slow kind of country!" said the queen. "Now, here , you see, it takes all the running you can do, to keep in the same place".