Quantcast
Channel: User HolyBlackCat - Stack Overflow
Browsing index pages (1668 articles)

Answer by HolyBlackCat for What's the rationale for std::current_exception(),...

Firstly, std::current_exception() allows type erasure. Let's say you want to pass the exception to some function that handles it. What parameter type should the function have? std::exception &?...

View Article


Comment by HolyBlackCat on How placement new creates multiple objects within...

@Dmitriano That's definitely the intent, as you can see from eel.is/c++draft/expr#basic.lval-11.3 . But turns out that section alone is not enough to make it work, hence those defects.

View Article


Comment by HolyBlackCat on How placement new creates multiple objects within...

@Someprogrammerdude Do you have a source for non-overlapping storage reuse destroying the old object?

View Article

Comment by HolyBlackCat on Why are "tiny" types like std::float8_t and...

@mkrieger1 I agree this shouldn't be tagged advice, but removing the tag invalidates some answers, so I've pinged the person who posted them.

View Article

Comment by HolyBlackCat on How to pass a constant array literal to a function...

@Hibou57 The second form is called a "compound literal" and is a C-only feature. Compilers are correct to complain about it in C++. The first form can be valid in C++, but it depends on the parameter...

View Article


Comment by HolyBlackCat on If A *happens-before* B in an execution, could...

I don't understand why you're asking this. You tagged this LL, but you yourself said that the spec doesn't define what wall clock time is, so anything is possible. And if you remove LL, the answer is...

View Article

Comment by HolyBlackCat on I need help choosing file dialog library for C++...

Unless you're locked into a specific ImGui backend, how about SDL? It both has file dialogs and can be used as a backend.

View Article

Comment by HolyBlackCat on Error when passing references to std::thread

While this is not what you asked, if your reason for using a thread is to have the NPC "think" in paralle with the gamel, then you probably shouldn't use threads. Instead you should break the NPC...

View Article


Comment by HolyBlackCat on What do these errors mean

While this is not what you asked, if your reason for using a thread is to have the NPC "think" in paralle with the gamel, then you probably shouldn't use threads. Instead you should break the NPC...

View Article


Comment by HolyBlackCat on Compiler complaining about non-copy-assignable...

Eh, do we need a self-answered Q&A for this? It's basically just a forgotten if constexpr (plus maybe not knowing what triviality means on an assignment). I think each of the two should have dupe...

View Article

Comment by HolyBlackCat on Compiler complaining about non-copy-assignable...

I don't think it's really a bug. You just shouldn't have always-false ifs.

View Article

Answer by HolyBlackCat for Accessing struct members via pointer is not...

At constexpr you don't necessarily have the same memory layout as you do at runtime.Maybe some compilers use the same layout as at runtime, but they might as well store the struct members in a...

View Article

Answer by HolyBlackCat for How to get CreateProcess/CreateProcessW to execute...

My testing shows that passing \\?\....-style absolute paths to lpApplicationName does work.

View Article


Comment by HolyBlackCat on How to define copy assignment operator to not be...

Is this the entire error message? For me both GCC and Clang clearly say that the assignment is deleted because of a reference member.

View Article

Comment by HolyBlackCat on Why is it necessary to include .h files in their...

It's indeed unnecessary in this simple case, but it becomes necessary in more complex cases. It's easier to always do it and not think about it. One example where it's necessary is if the header...

View Article


Comment by HolyBlackCat on Why is it necessary to include .h files in .cpp...

It's indeed unnecessary in this simple case, but it becomes necessary in more complex cases. It's easier to always do it and not think about it. One example where it's necessary is if the header...

View Article

Comment by HolyBlackCat on Does using an atomic variable for data eliminate...

@AndrewHenle I've added a note about this.

View Article


Comment by HolyBlackCat on What does constexpr atomic::wait() do at compile...

I'd assume it does nothing if the value is already correct, or errors instead of waiting otherwise.

View Article

Comment by HolyBlackCat on Why is `std::pair` not designed to be trivially...

Partially specializing the trait is nonsense. What they should've done is special-casing the pairs with reference members to use a custom assignment, and use the defaulted one for everything else. This...

View Article

Comment by HolyBlackCat on Creating macros with parameters outside of...

The only way it could work is if they have a separate program that processes C++ code: looks for those macros and injects extra stuff into the classes written after them.

View Article
Browsing index pages (1668 articles)


Latest Images