LB--

Results 116 comments of LB--

> I'm wondering, when my constructor is private, how can the standard library function call it? Shouldn't that be a compilation error? Maybe I misunderstood you, as indeed private and...

Check out the example on cppreference for `std::chrono::zoned_time`: https://en.cppreference.com/w/cpp/chrono/zoned_time

In earlier C++ standards I found a workaround that can sometimes be used: just inherit from an empty base class and use that base class as the pointer type instead...

Space for the returned object is allocated by the caller, but only the callee knows how it should be constructed, so the callee does the construction of the return object...

This might be a better test maybe? Though it's still difficult to tell who exactly runs the destructor here: https://godbolt.org/z/xW9PhdMTP Also I don't know why MSVC doesn't print the destructor...

This is very OS-specific, because random other components you link to may write to the process stdout/stderr themselves, bypassing whatever you do with the C or C++ standard library APIs....

It would warn everywhere though, this situation comes up all the time in perfectly normal safe C++

It is common practice to inherit from non-polymohprhic classes, e.g. for CRTP, disabling copy/move, invasive linked lists, explict object parameter helpers, and more. In the majority of those cases, the...

> Maybe it's just game development that's my line of work, but CRTP is not common. I also work in game development, I don't see how that relates to coding...

> If you have a std::unqiue_ptr and you rely on the automatic memory deallocation of std:unique_ptr to come to your rescue, that would actually result in exactly the same bug...