Was just wondering if strings were made part of the c++ standard. I like working with char arrays even though it's more work, but if there is a standardized string now then i should probably learn it.
Was just wondering if strings were made part of the c++ standard. I like working with char arrays even though it's more work, but if there is a standardized string now then i should probably learn it.
I think std::string has always been part of the C++ standard. Even if it hasn't, it is now.
http://www.cprogramming.com/tutorial/string.html
From C to shining C++!
Great graphics, sounds, algorithms, AI, pathfinding, visual effects, cutscenes, etc., etc. do NOT make a good game.
- Bubba
IDE and Compiler - Code::Blocks with MinGW
Operating System - Windows XP Professional x64 Edition
There has been only one C++ standard (from 1998). It included a specification for a standard library. That standard library includes a string class (called string). So, the string class is part of the C++ standard, and is therefore portable to all standards-compliant compilers.
Technically speaking the string class isn't part of the language itself, it is implemented in terms of the C++ language, and can be implemented in many different ways by the library writers. However, it is still considered part of standard C++, so learning it is an excellent idea.
So while it's not part of the C++ language, the string class will be the same for all compilers and platforms?
Short answer: Yes.
It is part of the standard library, which is part of the language standard. That means that any compiler that follows the C++ standard will provide the same guarantees that the standard gives. Basically you can use the string class and it will work on all modern compilers.
It is the same as standard C library stuff like rand(), strlen(), memcpy(), etc. Those aren't keywords that are part of the actual language, but they are part of the standard library so you can use them on any standards conforming compiler.