« first day (1771 days earlier)      last day (1073 days later) » 

10:58 AM
string vs char*
Which one's better
And why
 
std::string is better if you need value semantics
std::string_view is better if you need reference semantics
char* is better when you need to interact with C code :P
 
What's value semantics @PeterT
 
When you do
T a;
T b;
a=b;
and then 'a' and 'b' are independent values that you can change independently and don't depend on one another
 
nwp
11:35 AM
Most of the time even when interacting with C code you still want std::string. You can use std::string.data() to get a char * if needed. Only when the C code tries to use free on it do you actually need to handle that manually.
Phrased differently, std::string is a wrapper around char * that does a lot of the annoying stuff for you automatically.
 

« first day (1771 days earlier)      last day (1073 days later) »