I am just looking at some code with the following rough outline. so if i called like this Some questions around this are that if f returns a ref ...
I am just looking at some code with the following rough outline. so if i called like this Some questions around this are that if f returns a ref ...
Assuming X and Y are suitable types for such usage, is it UB to use std::start_lifetime_as<X> on an area of memory in one thread as one type and ...
In the 3.8 Object lifetime, there is the following section Before the lifetime of an object has started but after the storage which the object wil ...
I have a question about the object life time and assigning values to member variables vs calling member variables via an encapsulation like a getter. ...
I have scripts that contains one object named myElem. This element is scrollable and I want to scroll to bottom programmatically. My problem is tha ...
I have a simple linked list node class which I can use to create a list 1->2->3 like so: I want to make this construction less verbose by add ...
I'm learning Rust (I'm a C++ dev) and I'm still getting used to the borrow checker. I have the following example (which is also on godbolt: https://go ...
The Python reference on the data model notes that catching an exception with a ‘try…except’ statement may keep objects alive. It seems rather o ...
Consider struct full { struct basic { int a = 1; } base; int b = 2; }; void example() { alignas(full) std::byte storage[ ...
Would it be possible for a programming language to consistently have Rust-style ownership and lifetimes (for automatic memory management) while droppi ...
I worked with a class with unique_ptr pointing at object and method set it in runetime asynchroniously to nullptr and then another method might call m ...
As you know in C++, if a temporary object is bound to a local reference, then the lifetime of the temporary is extended till the end of the scope. Bu ...
Please consider this simplified c++14 program: https://gcc.godbolt.org/z/1GWvGfxne GCC prints here Meaning that std::initializer_list is destru ...
According to the standard: 5.13.5 String literals [lex.string] 16 Evaluating a string-literal results in a string literal object with static ...
What does the standard have to say about function-local static initialization during program exit? EDIT: For clarity, I mean a case as in the code exa ...
We have following code(it's more complicated ofc, I tried to make a minimal example). This code works perfectly fine on g++ before g++-11. With g++ ...
Disclaimer: This is rather more out of curiosity than for a lack of other solutions! Is it possible to implement a function in C++ that: gets pas ...
Another question cites the C++ standard: 3.8/1 "The lifetime of an object of type T ends when: — if T is a class type with a non-trivial destructo ...
It's hard to put into words so I will directly jump into a semi-pseudo-code. I have a download function (http GET), that is being called many many ti ...
Some types are defined by standard as implicit-lifetime types, and arrays are among them. Some functions implicitly create objects with implicit-lifet ...