My point of view is:
- Never use char * if you don’t call “C” code.
- Always use std::string: It’s easier, it’s more friendly, it’s optimized, it’s standard, it will prevent you from having bugs, it’s been checked and proven to work.
More Related Contents:
- Converting std::string from const_iterator to char*?
- Is std::vector so much slower than plain arrays?
- How to initialize std::vector from C-style array?
- How to implode a vector of strings into a string (the elegant way)
- std::string::c_str() and temporaries
- Why don’t the std::fstream classes take a std::string?
- I want to convert std::string into a const wchar_t *
- Can std::begin work with array parameters and if so, how?
- what is the best modern c++ approach to construct and manipulate a 2d array [closed]
- array vs vector vs list
- How do I store arrays in an STL list?
- Is std::string size() a O(1) operation?
- Converting between C++ std::vector and C array without copying
- C++ STL: Array vs Vector: Raw element accessing performance
- How to cheaply assign C-style array to std::vector?
- How do I use arrays in C++?
- What is the easiest way to initialize a std::vector with hardcoded elements?
- Initializing a static std::map in C++
- Array index out of bound behavior
- Determine the size of a C++ array programmatically?
- Returning arrays from a function in c++
- Why can’t we pass arrays to function by value?
- how do you insert the value in a sorted vector?
- Reorder vector using a vector of indices [duplicate]
- Is the C++ std::set thread-safe?
- Why is the STL so heavily based on templates instead of inheritance?
- How to sort an STL vector?
- How can I make the map::find operation case insensitive?
- Array of size defined by not constant variable
- int *array = new int[n]; what is this function actually doing?