Anish
Anish
Isn't c++ good for competitive programming
Never Spam Bot
~ is now approved by the group admin and can send messages without any restrictions
Can someone give very simple explanation of the different between RAII and unique pointer? As far as i understand is (correct me if my understanding is wrong), unique pointer is raii, i do not need to write my own raii with class object { constructor() ~destructor() } but just writing normal class and create the object with std::make_unique, or std::make_shared if it will be shared
See spam? Quote the spam message in the group and reply with /spam
Pavel
unique_pointer manages memory (and the stored object lifetime) using RAII, so you don't need to manage these two parts manually when working with unique_pointer.
However if your class has some resources that it needs to manage (e.g. opening and closing files, or DB connection) and those are not managed with some "smart" class that cleans up the resources automatically, then you may need to implement that management in RAII way even if your class is stored in a unique_pointer.
To give a better explanation it would be good to see some code example of how you're using it.
Bella
I'm from Lancaster, MA
klimi
Anish
Jojo
Collaborative beginners in programming? Am in
Snivin
yo
Jojo
Yo
🇷🇺 Ryan
How did you guys leaned to code
a lady named CodeBeauty on youtube taught me C++ easiest and best so far; but i am still learning and i only learned basics from her then.
🇷🇺 Ryan
https://twitter.com/TrueCodeBeauty
Mohammad
harmony5 🇺🇳 ⌤
Ighor
Apoorva
Anyone freew
Maxim
Rose
Anyone freew
Don't ask meta questions. In other words, don't ask to ask. Questions like "Does anyone know XYZ?", "Has anyone used XYZ?" or "Can someone help me?" are all considered meta questions because they don't specify what your actual problem is.
These questions give the impression that you want people to approach you and offer their help as if they don't have any other work to do. Now doesn't that expectation make you look like an idiot?
If you have a question ask it directly. You are more likely to get a response that way.
🧑🦲usean
5 applications I've deployed on my Raspberry Pi with K3s
https://www.xda-developers.com/applications-deployed-raspberry-pi-k3s/
mito
klimi
~
I tried to learn coroutine yesterday, got plenty of segfaults and bus erros until finally I can run it. But I stil do not know the correct use case, does anyone here can help? >,<
🇷🇺 Ryan
Replying to 3yo msg…
i dont read in here as often as you do. i was something like 10,000 messages behind for a year or longer
🇷🇺 Ryan
smarter spam
just because i responded to an old message doesnt make me a spammer
🇷🇺 Ryan
i just simply am super far behind on most channels i joined. i usually dote on maybe 1 channel and i have 2 of my own
🇷🇺 Ryan
in fact i am still right now 10K messages behind...... i havent read even a fraction of them, yet
Ighor
klimi
rand
有说中文的吗?
Vlad
English only
Vlad
Vlad
Maybe beneficial for UI programming too. To not block main UI thread and to not deal with the thread pool.
~
Is it equal to goroutine or async await?
~
I already know if it is goroutine or async await, if coroutine is equal to them then it is for non blocking IO
Vlad
Vlad
~
Have you use it? How usually you use it?
Vlad
Vlad
Cause I don't do backend in C++, if I had I would have
~
Bro you can do what you want
I do not think it is meant for CPU taks if it is analogous to goroutine and async await, because it will run on top of OS threads. Like 100 coroutines <-> 8 OS threads, 8 OS threads run 100 coroutines. It is how goroutine and async await are used
Vlad
Vlad
What is your point
Vlad
thread pools and coroutines are to mitigate overhead on creation/destruction of threads
~
I mean for example single threaded app. It does not matter how many coroutines you create, if that coroutine render a graphic for 5 minutes, the OS thread is blocked for 5 minutes, coroutine does not makes it concurrent or paralel for CPU task. Only multiple OS threads can
Vlad
Vlad
You can make 5 different tasks
Vlad
And send it to the thread pool
Vlad
That will do the work needed in parallel
~
you still have to use your brain yes
I just correct a bit of your comment that it will not block the thread if it executing blocking task. Because that is how single threaded goroutine and async await works
~
Because you say it is like that goroutine and async await 😅
Vlad
Vlad
Vlad
Vlad
Vlad
That's how multithreading is implemented on single core cpu's
~
Vlad
Vlad
OS sets up an interrupt timer
Vlad
After some time has passed it reallocates where does the execution goes next
Vlad
You get seemingly "parallel" execution
~
Yes
I does not execute paralel, it just executes every task for some duration then moves to the other for some duration then come back again, some duration again continously
~
That is not executing 2 thing at the same time
Vlad
Vlad
This IS how OS work
~
But it just makes it looks like at the same time where actually not at the same time. I think you are mixing about concurrent and paralel 😅
Vlad
It did that in the 90s already, with no multicore cpu's
Vlad
Vlad
Does it block?
Vlad
The answer is no
Vlad
Vlad
In your OS right now is thousands of threads and processes