Comment by HolyBlackCat on How to silence unused command line argument error...
@KenSharp c++ isn't a valid name, it's usually either libstdc++ or libc++. (Your flag gives me an error about this, rather than the "unused flag" warning.) For some reason, I no longer get the unused...
View ArticleComment by HolyBlackCat on no match for 'operator==' in GCC 12
Overloaded operators should be in same namespace as one of the operands. Then ADL can find them and the declaration order doesn't matter.
View ArticleComment by HolyBlackCat on overwrite std::vector with another std::vector...
@DanMašek OP themselves said "must be guaranteed ... that the size of new is not changed. ... Clearly, std::move does not work because it changes the size of the vector."
View ArticleComment by HolyBlackCat on How to resolve the "unknown array size in delete"...
@TedLyngmo Though it's not an appropriate replacement for a flexible array member.
View ArticleComment by HolyBlackCat on How to resolve the "unknown array size in delete"...
std::vector and friends vs flexible array member is not a C++ vs C thing. There can be a legitimate need for a flexible array member or equivalent even in C++ (avoiding one extra heap allocation).
View ArticleComment by HolyBlackCat on Does delete uses free() in the background in cpp?
It's not guaranteed, I believe.
View ArticleComment by HolyBlackCat on How to avoid scientific notation in C++
Whether or not the scientific notation is used depends only on how you print the value. A variable on its own can't have that notation (or any notation).
View ArticleComment by HolyBlackCat on Clang rejects inexplicit enum value in constexpr...
Since C++17? What did C++17 change, I thought it was always like this?
View ArticleComment by HolyBlackCat on Is there any way to set clang 15 to compile c++17...
Compilers in general need a bunch of flags to behave well (enabling warnings, disabling non-standard extensions, etc). Start using a build system so you don't have to type the flags every time.
View ArticleComment by HolyBlackCat on where to load arial.ttf font and any other font...
Find a free font that you're allowed to distribute with your app. Arial isn't one, I believe. Try something from fonts.google.com
View ArticleComment by HolyBlackCat on Why am not I getting any output, after building...
When executables mysteriously don't run, it always ends up being a DLL issue. Read this: stackoverflow.com/q/78598336/2752075
View ArticleComment by HolyBlackCat on C++ - Function inaccessible when non-const version...
@Someprogrammerdude Nope, it's the other way around. :)
View ArticleComment by HolyBlackCat on Is there a C++ IDE force me to use modern features?
Asking for tools is off-topic, but: Clang-tidy includes a bunch of modernize-... warnings, they might help. Clang-tidy is included in Clangd, which is what almost every modern IDE uses for code...
View ArticleComment by HolyBlackCat on Compiled C++ .exe file error when opening...
This code stands for STATUS_IO_REPARSE_TAG_NOT_HANDLED. Never seen that before. Is your file inside a onedrive directory? If yes, move it out. If not, I don't have any ideas other than reinstalling...
View ArticleComment by HolyBlackCat on Deduce constructor argument types for a class...
What could possibly work is what boost.pfr does to detect types of struct members (make a class with a templated operator T, try passing it to the constructor, use stateful metaprogramming to extract...
View ArticleComment by HolyBlackCat on Using decltype() on invalid expressions
What you do is template <typename T> struct WrapDoFoo {using type = function_traits<&T::DoFoo>;};. Then std::conditional_t<__, WrapDoFoo, WrapDoBar>::type.
View ArticleComment by HolyBlackCat on hey , cpp compiler problem ... help meee pleaseeee
Is it always printing the first line only? Or nothing changes at all when changing the code? Perhaps you forgot to re-run g++ after changing the file?
View ArticleComment by HolyBlackCat on How can I restrict array parameters in C (without...
You understand that (1) and (2) are fully equivalent, right? Even if it turns out it's not possible with the array syntax (nevermind, apparently it's possible, see link above), you could still do int...
View ArticleComment by HolyBlackCat on Why is copying heap data said to be expensive?
Are you talking about copying being slow compared to moving?
View ArticleComment by HolyBlackCat on C++ executable file showing virus
This is a false positive. Add the directory to the exceptions in your AV software.
View Article