🔒 Locked
STL String
Advertisement
Original Post
Which insert() function ? How did you make the copy ?
Do you have a minimal test case that crashes ?
<pedantic> The std::string class is part of the C++ standard library, but not of the STL </pedantic>
[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
Do you have a minimal test case that crashes ?
<pedantic> The std::string class is part of the C++ standard library, but not of the STL </pedantic>
[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
quote:
Original post by FrunyThe std::string class is part of the C++ standard library, but not of the STL ![]()
std::string is part of both. Having said that, I'd prefer it if people stopped referring to it as "STL string" (which also happens with vector and friends), since there's often an implication string is somehow an optional add-on to C++ and not actually a part of the Standard Library.
[edited by - SabreMan on January 5, 2003 9:22:38 AM]
ok im using the C++ standard libary string
to copy the string''s I just use the = operator
String1 = String2;
I use insert to insert 1 character, ie:
insert(m_Cursor,1,result);
they seem to cause it to crash. I don''t use empty anymore but that also caused it to crash.
Note that insert & operator= don''t crash every time, sort of when I reach a certain position.
to copy the string''s I just use the = operator
String1 = String2;
I use insert to insert 1 character, ie:
insert(m_Cursor,1,result);
they seem to cause it to crash. I don''t use empty anymore but that also caused it to crash.
Note that insert & operator= don''t crash every time, sort of when I reach a certain position.
The overloaded string& std::insert( size_type idx, size_type num, char c) fails if idx > size(). If you somehow corrupt the string, it may crash on any operation.
[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
quote:
Original post by SabreMan
std::string is part of both. Having said that, I''d prefer it if people stopped referring to it as "STL string" (which also happens with vector and friends), since there''s often an implication string is somehow an optional add-on to C++ and not actually a part of the Standard Library.
Hang on, doesn''t STL stand for "Standard Template Library"? I always thought "STL" and "C++ Standard Library" were interchangeable?
If I had my way, I''d have all of you shot!
codeka.com - Just click it.
quote:
Original post by Dean Harding
Hang on, doesn''t STL stand for "Standard Template Library"? I always thought "STL" and "C++ Standard Library" were interchangeable?
Not interchangable. The Standard Template Library was incorporated as part of the C++ standard library, but there are parts of the standard library that are not parts of the STL, like locales.
Not every class template is part of the STL, even though the string classes do qualify as a STL-compatible container (of char, wchar_t, unsigned char... whatever
).
The C++ standard library includes
- the C standard library (yup)
- the Standard Template Library (STL)
- strings
- iostreams (NOT the old iostream.h)
- complex numbers
- valarrays
- auto_ptr
- locales
The STL consists in
- containers
- iterators
- algorithms
- functors
- allocators
And probably more stuff I have forgotten
[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
The C++ standard library includes
- the C standard library (yup)
- the Standard Template Library (STL)
- strings
- iostreams (NOT the old iostream.h)
- complex numbers
- valarrays
- auto_ptr
- locales
The STL consists in
- containers
- iterators
- algorithms
- functors
- allocators
And probably more stuff I have forgotten
[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement