Comment by HolyBlackCat on Why are C++ guranteed copy elision not chainable?
It's not about it not being chainable, it is chainable. There's no guaranteed copy elision when returning a variable, only when returning a prvalue.
View ArticleComment by HolyBlackCat on undefined reference to `WinMain@16' in openGL C
What tutorial are you using? You need -lmingw32 -lSDL2main -lSDL2 (in this order), not just -lSDL2. This is likely what you're missing. Also an obligatory reminder that your GCC is outdated (6, while...
View ArticleComment by HolyBlackCat on Real const shared instance
"Doctor, it hurts when I do this." "Then don't do that!" Just don't retain the original non-const pointer. DataHolder dataHolder(std::make_shared<Data>(Data{5}));.
View ArticleAnswer by HolyBlackCat for concept to check "A" is derived from "B"
You check this by attempting to call a dummy (templated) function accepting a pointer to the base. This will reject inaccessible or ambiguous bases, but this is usually desirable.namespace detail{...
View ArticleAnswer by HolyBlackCat for undefined reference to `WinMain@16'
You're missing the main() function (or WinMain()).If you do have one, you probably forgot to save your source code, and ended up compiling an empty file (without main()).You can use either main or...
View ArticleAnswer by HolyBlackCat for C++ variadic template with values instead of...
This syntax isn't viable, because most types can't be template parameters. Among other things, you can't pass string literals (there are workarounds, but they don't work for your case).The only viable...
View ArticleComment by HolyBlackCat on Variable assignment in gmake seems broken?
FYI, you can do override CFLAGS = ..... to ignore the command-line parameters.
View ArticleComment by HolyBlackCat on Pass lambda to templated function with deduced types
You moved a function pointer but didn't move the std::function parameter, looks like a typo.
View ArticleComment by HolyBlackCat on Pass lambda to templated function with deduced types
@gruszczy gcc.godbolt.org/z/54Kzh9rT4
View ArticleComment by HolyBlackCat on C++ std::unique_ptr deleter syntax
@Red.Wave And also this doesn't waste memory on a function pointer!
View ArticleComment by HolyBlackCat on How to build to Android from Windows with the...
MinGW is unrelated to Android, it compiles for Windows.
View ArticleComment by HolyBlackCat on Why does it say undefined reference even though...
Latest version of mingw? You're on GCC 6, while the latest is 14. You can get the latest one from MSYS2 (along with SDL2, so you don't have to install it manually).
View ArticleComment by HolyBlackCat on static assertion fires from return type when...
The substitution happens before this elimination as per eel.is/c++draft/over.over#3, and the error happens during that substitution. Which means the program is ill-formed, I believe?
View ArticleComment by HolyBlackCat on How does Clang find it's default sysroot / target...
And instead of setting the env variable manually, you can run also run clang from the VS developer prompt.
View ArticleComment by HolyBlackCat on Clangd auto-inserts C++ headers instead of C headers
What do you mean by "imports"? Auto-inserts them when completing functions from them?
View ArticleComment by HolyBlackCat on Forbid temporary lifetime extension in C++
There's nothing you can do.
View ArticleAnswer by HolyBlackCat for Are pointers addresses in C?
In practice pointers are addresses (except perhaps on some very obscure platforms), but there are additional restrictions attached to them (the compilers can optimize with the assumption that you don't...
View ArticleComment by HolyBlackCat on How to connect CMake to Qt6 static?
Install CMake in MSYS2 too. The log shows you're using an external one.
View ArticleComment by HolyBlackCat on Error linking files with wam-ld when linking c...
Try building in verbose mode to see what the linker command is. Also try -pthread instead of -lpthread. And CMAKE_EXE_LINKER_FLAGS.
View Article