Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » The Danger of c-style Strings

This thread is locked; no one can reply to it. rss feed Print
 1   2 
The Danger of c-style Strings
Trezker
Member #1,739
December 2001
avatar

Templated arguments in strings? I have been using strings a lot and I haven't noticed a single templated thing about them, ever.

BAF
Member #2,981
December 2002
avatar

I asked the same thing. I guess the other string class has templated arguments, but std::string is just a typedef for basic_string<char>, and basic_string doesn't have templates.

Neil Black
Member #7,867
October 2006
avatar

I'm sorry, but I just don't see why this thread was started. Did anyone NOT know that? Excepting maybe a few beginners who don' have much experience?

Thomas Fjellstrom
Member #476
June 2000
avatar

Quote:

basic_string doesn't have templates.

No, but it IS a template.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

BAF
Member #2,981
December 2002
avatar

So? That doesn't make the "templates are confusing" argument valid. You can happily use std::string and be totally ignorant of templates for the most part (you may be confused by some compiler errors, then again, I've seen way worse errors).

Neil Black
Member #7,867
October 2006
avatar

I use std::string, and I have no idea what a template is. I haven't had a problem with it since the last one I asked about here.

bamccaig
Member #7,536
July 2006
avatar

BAF
Member #2,981
December 2002
avatar

Quote:

I use std::string, and I have no idea what a template is. I haven't had a problem with it since the last one I asked about here.

Hear the evidence for yourself!

ImLeftFooted
Member #3,935
October 2003
avatar

Heh, why do threads like this always end in an argument?

BAF
Member #2,981
December 2002
avatar

Hmm, I said something about it being a.cc, and expecting a thread not to end up like that. I forgot who sigged it.

 1   2 


Go to: