Liste des Groupes | Revenir à cl c |
In C you learn how to write less code.You do th same in C, but manually.
RAII, destructor, constructor is a bad idea, but I don't know if it is a good place to talk about it. I also don't know if I will be able to convince you.If you have a allocated resource you've to deallocate it at the end of
One problem of RAII and destructor we cannot disable it.If you've got to deallocate the memory you need the destructor.
By the way, in C++ we cannot move const objects. This is ridiculous.Const-objects are there not to be modified. If you've got logical
How we call it does not change the fact is the someone else wrote the code. Then we write less code if we use other people code.Such code from the standard library is optimal in terms of performance.
#include <memory>In C you've no OOP and no unique_ptr, everything is done manually
struct base2 {
virtual std::unique_ptr<struct base> clone();
};
struct derived2 : public base2 {
struct std::unique_ptr<struct derived> clone() override{
return this;
}
};
string_view was a "fix" and then we will have a fix for a fix etc..string_view isn't a fix, it's a very useful feature.
Les messages affichés proviennent d'usenet.