L0kzy
klimi
void
Anonymous
Ya but I got this https://github.com/gcc-mirror/gcc/tree/master/libstdc%2B%2B-v3
Anonymous
where in there?
klimi
What more to say
Anonymous
wanted a string class implementation code
Anonymous
I don't know how to do that
Anonymous
kindly help
Anonymous
In which folder will that be?
Mihail
weird but ok
Anonymous
Mihail
No string.cpp here
well that's for libcxx. if you're looking at libstdc++ then idk
Anonymous
I just wanted string class implementation code
Anonymous
and nothing else. Where ca I get it?
klimi
Mihail
Anonymous
Aah !! But I guess I made someone upset
Anonymous
sorry
Anonymous
guys
klimi
guys
Its okay, you will get there eventually
Anonymous
I got it.
Anonymous
But the reason I was asking is
Anonymous
that
Anonymous
which data-member of the string class holds the text when we write
Anonymous
string s = "abcd";
Anonymous
that's it
Anonymous
because naturally "abcd" is of type const char*
Anonymous
correct me on this if im wrong
Mihail
that's implementation-defined, but you can use std::string::data to get a pointer to it.
Mihail
but editing the memory referenced by that pointer is undefined behavior
Anonymous
but I guess the standard implementation must have used some pointer to "abcd".
Anonymous
Is that so?
Anonymous
https://github.com/llvm-mirror/libcxx/blob/master/src/string.cpp
Searching "data" shows nothing.
Anonymous
Searching "data" shows nothing.
Anonymous
here
Mihail
Mihail
it doesn't contain the whole definition or implementation of the class
Mihail
what are you trying to do?
Anonymous
Is any text enclosed in "" double quotes const char*?
Mihail
Anonymous
just wait a bit getting back to u in a sec
Anonymous
https://www.youtube.com/watch?v=Rr1NX1lH3oE
Anonymous
because in this video 3:24
Anonymous
he says "Cherno" is not a std::string but it is const char array
Anonymous
So any text enclosed in double quotes is const char array
Anonymous
and not std::string
Mihail
yes that's true
Anonymous
My bad I was speaking const char*
Anonymous
So that's what I
Anonymous
m asking
Anonymous
what data-member of string class is the "abcd" getting assigned
klimi
"Abcd" is just chars in memory
klimi
So its const char*
Mihail
Anonymous
I'm not understanding ur meaning of implementation defined
Mihail
you can get a pointer to that with std::string::data
Mihail
Anonymous
I hope that the cpp developers use a standard library
Mihail
the standard doesn't define it and you can't be sure
Mihail
klimi
Anonymous
Although I have learnt that array do decay to pointers but they r not the same
I_Interface
better to use smart pointers
Artöm
Anonymous
Now this is getting completely over my head