Liam
i need to create in heap
Constructing objects in heap requires more mechanisms to ensure thread-safety.
MRT
why?
I need a lot of RAM
Liam
I need a lot of RAM
template <typename T> struct Singleton { static T* get() { static T* p{nullptr}; std::call_once(flag, [&]() -> void { p = new T; }); return p; } T* operator->() const { return get(); } private: static std::once_flag flag; }; template <typename T> std::once_flag Singleton<T>::flag;
Liam
remember to #include <mutex>
Liam
Make it a shared_ptr then
smart pointers here are dangerous.
Nils
Ohhh I see...
MRT
ok thank
Liam
Why
order of releasing static objects are not well defined. if one refers to another, it might cause a crash.
MRT
yes.
you worked on qtcpsocket ?
Liam
Yeah also memory would never be released right?
yes. but this kinds of static objects are released when process is ending. memleak is not a big deal in the aspect.
Nils
Ah.
Liam
you worked on qtcpsocket ?
nope. I'm not a *pure* C++ developer, actually, machine learning engineer instead.
MRT
Thank you very much, good luck
Liam
I need a lot of RAM
BTW, static objects are not allocated on normal stack mem. there is a section for global static objects.
Liam
your compiler will handle this well for you.
Raghad
Hi, any one can help me? I have this issue in vs : The system cannot find the file specified . I use _CRT_SECURE_NO_WARNING But dosent works
Andrew
And its WARNINGS not WARNING
Anonymous
would this be correct? https://gist.github.com/2c6ca37149c201b439d40ec55a0cd9a5 for resolving (a given cwd and a given path) to the directory, respecting trailing slashes
B M
Looking for point of sales
Radmehr
Hey everyone! I hope you are having a nice day! I am doing a research on programmer, the title is the effect of music on rogrammers and the whole post is on reddit, it is fun in my opinion but nobody has taken part yet…so I'll be so glad if you take part in it
Radmehr
Is it against the rules if I share the reddit link?
ɴꙩᴍᴀᴅ
Anonymous
Is it against the rules if I share the reddit link?
ask the admins., or come to OT GROUP
Radmehr
Thanks!
Anonymous
Oh nice
Anonymous
Well, at least we don't need to include async now
Anonymous
JavaScript programming — I love it!
✨ Anatolii
Так
Angelo
xD
✨ Anatolii
Funny prank
Maksym
ahahahha i barely unsubscibed from this channel
Hamid
WHAT
Anonymous
/get jsbook
Hamid
js is awesome
Anonymous
What do you mean?
Js is naturally asyncronous
Hamid
there is no programming languages better than js
Anonymous
co_await, co_yield, co_return is C++ language operators
Anonymous
Nice
Огни
Stop
Dima
oh yes
Огни
Where is c++?
Anonymous
Nice
You always learn something in a language with hundred+ keywords)
Hamid
Where is c++?
it's first day of april
Anonymous
co_await, co_yield, co_return is C++ language operators
Actually it's C++20 operators ... it's a long time I have been waiting for it.
Dima
because its js programming now
Hamid
april fools day
Anonymous
What do you wait?
To change the company project language standard to C++20.
Огни
I think better to change to Python poorgraming etc
Anonymous
Cpp20 is here
Yeah, i know it.
Anonymous
To change the company project language standard to C++20.
Tbh I'd not change it for 2 or 3 years
Anonymous
I think better to change to Python poorgraming etc
Python is not that much of a troll, I think
Anonymous
Tbh I'd not change it for 2 or 3 years
If it is some really critical software you build
Pavel
To change the company project language standard to C++20.
I did that recently to my hobby project, not that exciting as I anticipated it
Anonymous
Tbh I'd not change it for 2 or 3 years
Right, but i'm really love to using module, coroutine, ... in real project.
Pavel
I did that recently to my hobby project, not that exciting as I anticipated it
Some stuff that I expected would ease my life just doesn't work properly, or makes it harder
Огни
HTML programming
Hamid
Anonymous
wtf
Ihor
AHahahHHAHAHAHAHAH
Anonymous
who added me in this group?
Distac_221
april fools
Vlad
HTML programming
XML programming
Anonymous
😕
Anonymous
I did that recently to my hobby project, not that exciting as I anticipated it
No, not a hobby project. It's need to be used in a real project. Like a OS 😂 https://github.com/SerenityOS/serenity