☟☟ Upcoming C++ Best Practices – Tools online seminar, March 8th! ☟☟
Notes and info about episode:
Ep 188 – C++20’s `constexpr` `new` Support –
T-SHIRTS AVAILABLE!
► The best C++ T-Shirts anywhere!
WANT MORE JASON?
► My Training Classes:
► Follow me on twitter:
SUPPORT THE CHANNEL
► Patreon:
► Github Sponsors:
► Paypal Donation:
GET INVOLVED
► Video Idea List:
JASON’S BOOKS
► C++ Best Practices
Amazon Paperback:
Leanpub Ebook:
JASON’S PUZZLE BOOKS
► Object Lifetime Puzzlers Book 1
Amazon Paperback:
Leanpub Ebook:
► Object Lifetime Puzzlers Book 2
Amazon Paperback:
Leanpub Ebook:
► Object Lifetime Puzzlers Book 3
Leanpub Ebook:
► Copy and Reference Puzzlers Book 1
Amazon Paperback:
Leanpub Ebook:
► Copy and Reference Puzzlers Book 2
Amazon Paperback:
Leanpub Ebook:
► Copy and Reference Puzzlers Book 3
Leanpub Ebook:
► OpCode Puzzlers Book 1
Amazon Paperback:
Leanpub Ebook:
RECOMMENDED BOOKS
► Bjarne Stroustrup’s A Tour of C++ (now with C++20/23!):
AWESOME PROJECTS
► The C++ Starter Project – Gets you started with Best Practices Quickly –
► C++ Best Practices Forkable Coding Standards –
O’Reilly VIDEOS
► Inheritance and Polymorphism in C++ –
► Learning C++ Best Practices –
✅ Camiseta De Futbol Baratas Player vs Fan | camisetasfutboleses
🛒 Cómprala aquí: https://www.pidecamisetas.com/
📸 Siguenos en Instagram: https://www.instagram.com/msy_es/
📲 WhatsApp: +86 166 5930 6369
👏 ¡Muchas gracias por ver el vídeo! 👏
🔴 LIKE & SUBSCRIBE 🔴
🔴 Keywords:Camisetas Copa Mundial de Fútbol
__
🏷️ TAGS:
CAMISETA Real Madrid 22/23
camisetasfutboleses
camisetasfutboleses.com
CAMISETAS FUTBOL SPAIN
CAMISETAS DE FUTBOL
CAMISETAS FUTBOL Baratas
CAMISETAS DE FUTBOL 2020
CAMISETAS DE FUTBOL 2021
CAMISETAS DE FUTBOL 2022
CAMISETAS FUTBOL EQUIPOS
CAMISETAS FUTBOL SELECCIONES
CAMISETAS DE FUTBOL BARATAS
MEJORES CAMISETAS DE FUTBOL
EQUIPACIONES FUTBOL
EQUIPACIONES DE FUTBOL
Otros sitios web de nuestra empresa para que los visite:
Why not call constructor of string inside of constructor of union using : s(s) syntax?
I didn't know before that C++ unions are allowed to have member functions – thanks Jason.
If only we had variants/safe unions with the interface of unions…
When you call destructor "s.std::string::~string();" What is this function call exactly and how to read this? I thought you would call destructor for local variable with "s.~string()". What am I missing?
One thing I don't understand is this idea of the "active member of a union". At runtime I don't think this concept exists, if you modify the int and you access the float, you get the float that is represented by the same bits you set on the int, and that's totally normal behavior and there's nothing UB about it as far as I know. How come at compile time these rules change? Feels like union at compile time just cannot really be sensibly used.
You gave me idea to make struct represente Union and so we can convert bits from type to other type without making a Union.
I always watching you in Cppcon and other
So why did he have to manually call the destructor? Shouldn't it be called either way?
Love the last point: just use STL.
It's nice that we can't have UB in constant expression context due to C++ standard expr.const. If we can write the code that will executed in constexpr context we'll have no UB in this code. I'm starting to think it's safer than situation in some other language in which UB can take place not only in some blocks but because of these blocks (somewhere safe)
Jason, raycasting engine tutorial in modern C++, please!
if you use, std::construct_at,/destroy_at, you are not far of using std::address_of to, for completeness' sake.
I think that if you have a union of say, two structs with common initial sequence of object (same type), you are allowed to de reference values of this common sub sequence. Say, union U { struct A {int A_; } an_a; struct B {int B_; } a_b; }; U a_u; a_u.an_a.a; and a_u.a_b.b; is legal. This is the underlying principle of many C libraries, say when you manipulate addresses using the typical sockets API or Windows Bitmap header as an example. I would be appreciate input on the subject.
Takeaway after 16 minutes: Don't bother using unions 🤣 A long time ago, I did exploit unions for implicit type conversions, but I haven't used any unions since then (i.e. for 25 years). The only place I encounter unions is STGMEDIUM and similar legacy Win-32 data types.
Shouln't you wait setting is_active until after construct_at, in case of an exception
What I want to know is why lParam and wParam in WndProc aren't unions.
wait a minute, this video was literally posted 1 minutes ago but the comment below is commented 1 day ago, how is this even possible?
You're funny. 14 of the 16 minute go to increasingly abstruse (but totally fascinating) stuff about unions, followed by the lesson that one shouldn't do this. Indeed: optional, variant, any, expected are much nicer.