Comment by HolyBlackCat on Replacing std::is_base_of_v in case of...
Even if you manage this to gracefully reject incomplete types, what if they actually inherit from A?
View ArticleComment by HolyBlackCat on Undefined references to SDL symbols?
I'm not seeing the -lmingw32 -lSDL2main -lSDL2 flags. What tutorial are you following? Also GCC 6 is quite outdated (latest is 14), I recommend installing the latest one from MSYS2.
View ArticleComment by HolyBlackCat on difference between runtime and compile time with...
"why can the compiler not find this out at compile time" It can in some cases, look up "devirtualization". Also there are some alternatives to virtual functions that do this at compile-time (CRTP).
View ArticleComment by HolyBlackCat on How to compile a project for Windows that uses...
Can you reproduce the errors when compiling a file containing #include <winsock2.h> and nothing else? What if you compile manually in the terminal instead of using cmake?
View ArticleComment by HolyBlackCat on Define constant within a class
Yes, static is necessary, otherwise a copy of the constant would be stored in every class instance (which wastes memory), and it would no longer be a compile-time constant (so wouldn't work as an array...
View ArticleComment by HolyBlackCat on thread_local + std::thread deadlock on destruction
Well yes, you just restated the question. :/
View ArticleComment by HolyBlackCat on im getting these errors while installing mingw...
@YodaSkywalker If it did install eventually, you should create a new question for you new problem, and provide more details (how exactly you configured VSC and so on).
View ArticleComment by HolyBlackCat on MSVC rejects delegating constructor using base...
Indenting your code correctly would be a good start. :/
View ArticleComment by HolyBlackCat on Compiling C/C++ code on windows11 with vscode
^ Which is solved by moving MSYS2 to be the first thing in PATH.
View ArticleComment by HolyBlackCat on Undefined Reference WinMain@16 in Makefile
@Barmar Both work. If it didn't work, the linker would complain about not being able to find the library...
View ArticleComment by HolyBlackCat on Simple for loop in C preprocessor
Check out BOOST_PP_REPEAT and similar macros in boost.preprocessor. They achieve this by pregenerating N boilerplate macros, allowing you to loop up to N iterations. This is impossible to achieve...
View ArticleAnswer by HolyBlackCat for C++ Get name of type in template
This trick was mentioned under a few other questions, but not here yet.All major compilers support __PRETTY_FUNC__ (GCC & Clang) /__FUNCSIG__ (MSVC) as an extension.When used in a template like...
View ArticleComment by HolyBlackCat on IntelliSense fails to deduct template arguments...
Try Clangd instead of the official C/C++ plugin.
View ArticleComment by HolyBlackCat on Create Hex File
This should probably be asked elsewhere. SO requires questions to be self-contained, and there's way too much information missing here.
View ArticleComment by HolyBlackCat on CMake pkg-config on Windows 11 returns error:...
Don't set environment variables manually (PATH, PKG_CONFIG_PATH, ...). Open MSYS2 MINGW64 terminal in the Start menu and they'll be set for you. Install CMake in MSYS2 (pacman -S...
View ArticleComment by HolyBlackCat on What is the ("spaceship", three-way comparison)...
I edited this to not imply that defaulting == implements it in terms of <=>. I've had at least one person confused about it
View ArticleComment by HolyBlackCat on Need help to organize 2D AABB collision engine...
You'll probably get better answers on gamedev.stackexchange.com. Also I recommend checking out box2d's BVH tree implementation, you could reuse that.
View ArticleComment by HolyBlackCat on Suggestion does not pop up after typed first...
I use Clangd instead of the official C++ extension, and it does autocomplete correctly in this case.
View ArticleComment by HolyBlackCat on Why std::expected's `operator==` is not...
And I believe tl::expected's ==is SFINAE-friendly, so it looks possible.
View ArticleComment by HolyBlackCat on Why std::expected's `operator==` is not...
And library implementers just rolled along with it. Bah!
View Article