Comment by Peter - Reinstate Monica on git - apply a commit on another branch...
@m7913d I took the liberty of editing the answer, making clear that without --no-commit the command will auto-commit. This is a central answer and should be clear.
View ArticleComment by Peter - Reinstate Monica on error: use of deleted function -...
The code would initialize the reference i with a reference to a temporary, a disaster.
View ArticleComment by Peter - Reinstate Monica on error: use of deleted function -...
Even more simply: If you want copy and assignment semantics you can use a pointer right away (which is what the wrapper does behind the scenes anyway, with a lot of fluff that's unnecessary here). The...
View ArticleComment by Peter - Reinstate Monica on error: use of deleted function -...
@DominikKaszewski As I said elsewhere, the possibility of an invalid state is typically an advantage in my experience. If not, it is trivial to make that guarantee explicit.
View ArticleComment by Peter - Reinstate Monica on How change every struct in an array of...
@Barmar Good idea, didn't think of it.
View ArticleComment by Peter - Reinstate Monica on Is this declaration UB?
@IanAbbott re "My take is that modifying a member of a union will damage the values of the other members": It will change what the memory contains -- but I suppose that in the case of a const value,...
View ArticleComment by Peter - Reinstate Monica on Why do C and C++ support memberwise...
The compiler has complete information about an array (including its size, the number of elements and the size of each element) in exactly the same way it has complete information about a given struct....
View ArticleComment by Peter - Reinstate Monica on std::regex throws exception during...
The answer is B, right? ;-)
View ArticleComment by Peter - Reinstate Monica on facing a problem 'Turbo C++ is not...
Which version did you tray to install, where did you download it from? Also, why did you try to install Turbo C++ and not, say, the free Microsoft Visual Studio Community edition??
View ArticleComment by Peter - Reinstate Monica on Can a moved from object be moved again?
@3CxEZiVlQ One should perhaps add the caveat that this is less a question of language than one of quality of implementation. The language does not enforce in any way that the moved-from object is in...
View ArticleComment by Peter - Reinstate Monica on git - apply a commit on another branch...
@m7913d I took the liberty of editing the answer, making clear that without --no-commit the command will auto-commit. This is a central answer and should be clear.
View ArticleComment by Peter - Reinstate Monica on Could the vector begin() be deduced?
I'm not entirely sure about your statement about "the result of an expression is not affected by the context". For example, there is argument dependent lookup where function name lookup is expanded to...
View ArticleComment by Peter - Reinstate Monica on Could the vector begin() be deduced?
Well, operator<<'s meaning (to pick just the best known) strongly depends on the context it's used in! So that argument is not always applicable.
View ArticleComment by Peter - Reinstate Monica on In C++, can I use a preprocessor...
Upvoted for "No, and why would you?" ;-)
View ArticleComment by Peter - Reinstate Monica on How Does the Left-Hand Side (LHS) of...
@chqrlie Which, as an aside, indicates that the creators of C originally were a bit flip with their type system, for historical reasons (the predecessors it was built on, the state of the art when it...
View ArticleComment by Peter - Reinstate Monica on Should I go with if-else or match-case...
I don't know dataweave or mule, but in general: Often, there is a third choice: Use a dictionary/associative container that maps the inputs to outputs. That is a specific case of a general choice...
View ArticleComment by Peter - Reinstate Monica on Why does `free` in C not take the...
As an aside, the option to return (or pass, or assign, for that matter) a struct by value didn't exist in K&R ('The only operations allowed on a struct are member selection with "." and taking its...
View ArticleComment by Peter - Reinstate Monica on How can argv in C be an array if its...
That is likely not (at least not generally) true -- under Windows, the program gets a single string, and -- as Andreas points out in his answer -- the C runtime library parses the string and presents...
View ArticleComment by Peter - Reinstate Monica on How can argv in C be an array if its...
Under Windows, the command line processor passes a single string to the program which is then responsible to pick it apart into arguments (with functions like this one). This is why some programs under...
View ArticleComment by Peter - Reinstate Monica on Deleting final line in a text file in C++
One thing you could do is to keep everything in memory and only write at the very end. There are only two reasons not to do that: The files are too big (unlikely these days with text); or you want...
View Article