MᏫᎻᎯᎷᎷᎬᎠ
It kind of is, but it's safer than C-style counterpart
Yeah But Don't overuse it unless there is real cast Not just because auto abscures the type
Francisco
I just use static_cast in libraries, when I want full control of the types
MᏫᎻᎯᎷᎷᎬᎠ
Francisco
And I normally use auto when I don't care at all about the type
MᏫᎻᎯᎷᎷᎬᎠ
Auto is great really Use it with functions especially
MᏫᎻᎯᎷᎷᎬᎠ
With the trailing
MᏫᎻᎯᎷᎷᎬᎠ
It's super clear IMO
Francisco
Auto + concepts = ❤️
MᏫᎻᎯᎷᎷᎬᎠ
Kapkong
🙏
Anonymous
inline String &String::operator=(const String &other) { if (this != &other) { if (std::allocator_traits<allocator_type>::propagate_on_container_copy_assignment::value) { if (allocator != other.allocator) { free(); first_element = nullptr; } allocator = other.allocator; } auto data = alloc_n_copy(other.begin(), other.end()); free(); first_element = data.first; first_free = one_past_capacity = data.second; } return *this; } how to provide strong exception guarantee inside if (allocator != other.allocator)
Anonymous
inline String &String::operator=(const String &other) { if (this != &other) { if (std::allocator_traits<allocator_type>::propagate_on_container_copy_assignment::value) { if (allocator != other.allocator) { free(); first_element = nullptr; } allocator = other.allocator; } auto data = alloc_n_copy(other.begin(), other.end()); free(); first_element = data.first; first_free = one_past_capacity = data.second; } return *this; } how to provide strong exception guarantee inside if (allocator != other.allocator)
in libstdc++ - the allocator is copied first, then new memory is allocated, then old memory is freed. finally the allocator is copied again, outside the if-else part. my question now is how would this copying work if an allocator has an internal state. the second copy of other.allocator() would be able to deallocate objects allocated by the first copy of other.allocator() since that is guaranteed by allocator copy construction and equality operator. however, their internal states would be different. if the allocators counted the number of allocations it made, for example, for some debug purpose, then the second copy would not have this information.
Killin
Why did I get a warning
András
Killin
Ok
Killin
So shouldn't I send a photo
Killin
Sorry
Nameful
But
Nameful
The rules aren't really readily accessible as the pinned message containing them was replaced with some advertisement
Dima
our fault
András
So shouldn't I send a photo
As good as I remember, screenshots are allowed
Killin
Oh
Dima
lets just keep it clean around
Killin
Then please remove the warning
Killin
Kk
Francisco
Why aren't the rules accesible?
Dima
#rules
Francisco
Oh, completely forgot
Nameful
#rules
Have you considered putting the link Rose spews out in the bio of the group?
Francisco
But I think there were new ones
Dima
But I think there were new ones
yes, now we need to find it. bruh.
Dima
https://t.me/programminginc/217064
Anonymous
Hi i have a qsn who can answer me?
01000001011011010100000101101110
Anonymous
Google
I tried but... i want the answer from seniors'....i'm beginner .... The qsn is.."how much time does it take to be a good programmer?? ..specialy on c++"
01000001011011010100000101101110
I tried but... i want the answer from seniors'....i'm beginner .... The qsn is.."how much time does it take to be a good programmer?? ..specialy on c++"
To be a good programmer you need to work on algorithmic thinking. C++ is vast. Try working on few projects and in sometime you'll understand cpp
01000001011011010100000101101110
No one can give you time span. But 3-6 months you'll do good
Dima
no
Dima
you are always learning
Dima
it may take years
01000001011011010100000101101110
Dima
but you need to start at least
01000001011011010100000101101110
01000001011011010100000101101110
0100001.... & dima Thanks
Happy coding! All the best.
Jaaziel
you are always learning
That is a fundamental idea for life. We have to stay learning all time, anywhere, with ourselfs and others.
Asad
do conditional statements slow down the program ?
Ashish Bhushan
It doesn't matter these days much...in small programs or in learning process as our systems are so fast that the increased time will be in microseconds
Ashish Bhushan
But yes it slows down the executing time of the program as the cpu has to do calculations with a given condition
Dima
Bruh.
Igor🇺🇦
do conditional statements slow down the program ?
If you need condition - you need condition. The main issue with branching is that it can screw up CPU pipe when branch predictor gets it wrong.
Sa
Hi
Sa
I need a help , can i ?
klimi
You can
Allan N Kiche
Hey guys
klimi
Sa
There's a question of competitive programming
Sa
I've solved it but I'm not sure where i am wrong
Sa
https://www.codechef.com/APRIL20B/problems/STRNO
Sa
https://www.codechef.com/viewsolution/31360503
Sa
This is my solution
Anonymous
Dima
wtf
Anonymous
LMAO
Anonymous
(-:
Caesy
Anyone into device drivers
Caesy
Anyone into device drivers
Need resources and guide
klimi
what driver do you want to write?
Caesy
USB flash drive
klimi
elaborate please
Asdew
Knowing the kernel for which you want to write the driver would help, too.
Caesy
I have a USB stick that I can't access its contents, giving some funny errors.
Caesy
What should I do then?