Comment by HolyBlackCat on How do I write a range-based for loop in C++ which...
Why is the variable static? Shouldn't a nonstatic one work?
View ArticleComment by HolyBlackCat on Why are deleted member functions not propagated...
Yes, the Bar's copy constructor is not SFINAE-friendly. It's the problem of Bar, not of whatever code is interacting with it. I don't really understand the question, since you already know about the...
View ArticleComment by HolyBlackCat on Parallelize a for loop with populating a large...
@PaulMcKenzie Given that they have the hardware with enough ram for that, something tells me they know what they're doing. :P
View ArticleComment by HolyBlackCat on Why does C++ introduce a "::" instead of using a "."?
There's no technical reason, just like in C there was no reason to have different syntax for . and -> other than clarity.
View ArticleComment by HolyBlackCat on modify to close automatically without pressing OK c++
So what stops you from showing that message box, or printing the message somewhere? And also please add the c++ tag (in addition to the c++XX version tag you already have).
View ArticleAnswer by HolyBlackCat for Where is it defined that references can be...
The standard uses "reference-compatible with" instead of "more/less cv-qualified" for reference initialization.This is described by [dcl.init.ref]/4 and [dcl.init.ref]/5.The definition of...
View ArticleComment by HolyBlackCat on trying to reverse a string and no idea why not...
Learn how to use your debugger. It would let you to step through your code step by step, which would help you notice your loop isn't entered.
View ArticleComment by HolyBlackCat on trying to reverse a string and no idea why not...
I'd rather VTC as typo.
View ArticleAnswer by HolyBlackCat for Visual Studio Code C/C++ IntelliSense setting to...
You could switch from the stock C++ intellisense to Clangd. It does show class size and alignment on hover. (And has some other advantages over the stock intellisense too.)
View ArticleComment by HolyBlackCat on VSCode how to set CMake option value from VSCode?
@Someprogrammerdude tasks.json just runs shell commands, there's almost nothing language-specific about it.
View ArticleComment by HolyBlackCat on Why does making allocator a data member change the...
If I pass by reference instead (bar(Storage<type> &n)), both versions generate the same assembly (the one with addq). Probably something about the allocator prevents it from being passed in a...
View ArticleComment by HolyBlackCat on My project build is failing to compile with gcc -...
The error tells you you're missing either a main function or WinMain. Either one will work, regardless of -mconsole/-mwindows. -mconsole is already the default, you don't need it. And...
View ArticleComment by HolyBlackCat on Are smart pointers that are members of a class...
If you only call make_shared() and not new or malloc, then the memory will be freed automatically, you don't need to delete anything manually.
View ArticleComment by HolyBlackCat on Can user-defined deduction guides be used to...
I don't think CTAD works in functions calls? With or without the guides.
View ArticleComment by HolyBlackCat on Did the behaviour of C++ copy constructor change...
@PepijnKramer The consensus is that asking about AI-generated content is allowed.
View ArticleComment by HolyBlackCat on r-value reference to default argument temporary to...
Yes, this looks good enough. I use this too. I'm not sure what answers you want, since you already cited all the right paragraphs.
View ArticleComment by HolyBlackCat on Is there any way to mark a function parameter as...
Only the entire function can be consteval, not individual params.
View ArticleComment by HolyBlackCat on uint8_t can't be printed with cout
This simply doesn't work correctly. Since those operators are not where ADL can find them, they can and will be shadowed by any random operator<< in user's namespace, and using namespace...
View ArticleAnswer by HolyBlackCat for why does 'using namespace' not take priority when...
As explained on cppreference, using namespace doesn't bring the names into the current scope. It brings them to the most nested common enclosing namespace of the current namespace and the one you're...
View ArticleComment by HolyBlackCat on why does 'using namespace' not take priority when...
@Eljay Might as well make it a plain function.
View Article