Anonymous
Because question itself is about public interface
Anonymous
I don't get the question
Suppose, the copy constructor is not private in ostream, then if we return the called out object without reference then will the chaining operation not be supported?
Anonymous
Because we have the object to call operator<< on
Artöm
Dont forget that stream writes the stuff to a file. Like, would a file be copied too?
Anonymous
Then we need to understand what it means to copy a stream
Nah, his question is more about expression evaluation
Artöm
Imo its not the thing to bother about first here
Anonymous
I didn't get the following statement below: if for any reason a base class fails to have a default constructor that's callable from a deriving class—that is, a public or protected constructor that takes no parameters—then a class that derives from it cannot automatically generate its own default constructor.
Artöm
If base class doesnt have default ctor, derived wont have it unless you provide it
{CSA}
Hi
I_Interface
What is this ? Why it's here?
I_Interface
2 mins no answer - warn.
I_Interface
/warn It's C/C++ discussing here.
I_Interface
Hi
Welcome.
Anonymous
`class base{ private: base(const base &obj) {} public: base(){} friend base fun(base &obj) { base nbj = obj; return nbj; } }; int main(){ base obj; fun(obj); return 0; }` here copy constructor gets called from inside the friend function so it gets called without any problem
I_Interface
class base{ private: base(const base &obj) {} public: base(){} friend base fun(base &obj) { base nbj = obj; return nbj; } }; int main(){ base obj; fun(obj); return 0; }
I_Interface
how to format multiline?
Just use formatting function from telegram. Select a text -> Right click -> Formatting -> Monospace.
Anonymous
`class base{ private: base(const base &obj) {} public: base(){} friend base fun(base &obj) { base nbj = obj; return nbj; } }; int main(){ base obj; fun(obj); return 0; }` here copy constructor gets called from inside the friend function so it gets called without any problem
But, when I call the friend funtion and pass by value(copy constructor gets called) then why doesn't that work? class base{ private: base(const base &obj) {} public: base(){} friend base fun(base obj) { base nbj = obj; return nbj; } }; int main(){ base obj; fun(obj); return 0; } Doesn't call by value happen inside the friend function?
MᏫᎻᎯᎷᎷᎬᎠ
/report
Magnvm_Khaos
Hi I have a question about sockets? Can i do a program like a calculator on the server that responds with solutions to questions of the client?
Roxifλsz 🇱🇹
Userbot?
Austin-sama
Yup
Roxifλsz 🇱🇹
/ban @Ginger093
Roxifλsz 🇱🇹
Yup
Nice
Austin-sama
😉
Anonymous
Theres no assignment there
During call of fun doesn't the call by value counted as being part the friend function?
Artöm
?
Artöm
I see copy construction, no assignment
Anonymous
I see copy construction, no assignment
Yeah, I'm talking about copy ctor. Why doesn't it it get called when the call is from parameter of the friend function?
Anonymous
main also tries to copy, to pass an argument
Actually, I want to ask that where does the copy constructor called from ? Inside the main?
Artöm
Yes, to create an argument. Then in fun to create nbj. Then move ctor is called to crrate an object being returned
Anonymous
Can I say that cout is a stream?
Artöm
It is
Anonymous
So, Just as cout is used as a stream between the program and the stdout, stringstream acts as stream between what 2 things?
Artöm
program and string variable
Anonymous
program and string variable
but isn't the string variable a part of the program?
Artöm
So? Not everything in program goes in cout
Anonymous
So? Not everything in program goes in cout
cout will copy the content of a variable into the stream and then the stream will feed it to the stdout Can you describe stringstream in those terms for me?
Jussi
I see copy construction, no assignment
base nbj = obj; This is not copy assignment?
Artöm
sstream copies variables to internal string and returns a copy of it when one calls str()
Artöm
base nbj = obj; This is not copy assignment?
It is copy construction, not assignment
Artöm
https://en.cppreference.com/w/cpp/io/basic_stringstream/str
Artöm
Yes
Jussi
It is copy construction, not assignment
https://en.cppreference.com/w/cpp/language/copy_assignment
Artöm
I know what assignment is bro. This T val = init; is copy construction
Artöm
Note T. You create a variable
Anonymous
https://en.cppreference.com/w/cpp/language/copy_assignment
https://www.geeksforgeeks.org/copy-constructor-vs-assignment-operator-in-c/
Abdul
https://youtu.be/lxryENRZ1kI
Anonymous
Guys i started my oops concepts recently and i would like to have some materials and resources regarding it ..
Anonymous
Wut
Anonymous
Hi guys.. can someone share ebook of c++ and vc++
Faisal
Hello, is there any one have a c# group 😅
NXiss7
Hi guys.. can someone share ebook of c++ and vc++
C++ Primer 5th Edition, not Plus one, be aware
NXiss7
Can't share e-book though...
NXiss7
Guys, I've written a library, built an API and want to open source it soon but I want to stress and quailty-control it as much as I can before releasing. Like code quality, architecture, performance, obvious dumb things.... Any suggestions?
YK Y
When we use **array[]
Francisco
no, a good project should have code that works
That's implicit in any project. If your code doesn't work, there's no point in anything else
...
having so many things for a kinda small scale project is overkill, and kills productivity though
NXiss7
Every good project should have, at least: - Continuous Integration - Tests - Benchmarks - Examples - Static analyzer/Address Sanatizer - Build system
Thank you. I have all of them except CI, don't know how to do it. It's been just a private project so far.
NXiss7
What about code quality?
NXiss7
And design?
Francisco
Thank you. I have all of them except CI, don't know how to do it. It's been just a private project so far.
Don't worry, I'm still struggling with Travis. It's not something you learn in a moment
NXiss7
And design?
And I want to make my lib thread safe. Are there "community recommended" checklists that I can follow. I've gone through some from internet including Google's guidelines.
Francisco
having so many things for a kinda small scale project is overkill, and kills productivity though
That may be true, but you learn a lot and also make sure the project has good quality. It's not mandatory to have them all. In my projects I have CMake, clang-tidy, clang-format, tests and examples. You can forget about them, but trust me, you also learn a lot using all of them
...
no, you just waste your time to satisfy your autism with some checkmarks being green and some numbers looking "okay"
Anonymous