yst 12:53
But it would also be invalidated by input.assign
yst 12:52
Yes, that would be invalidated
yst 12:48
So there's nothing to invalidate
yst 12:48
auto my_iter{input[0]} declares a char, not a char&
yst 12:47
Yes, calling begin and end after changing the string still works
yst 12:42
Which is why I'm saying there's no difference between creating the string 2*7 and assigning that to input, and calling input.replace(2, 5, "7")
yst 12:40
Which doesn't matter, because you aren't using it anymore.
yst 12:40
Yes. Which also stop pointing where they used to. Consider what happens when you evaluate 2*(3+4). You replace (3+4) with 7, so the index for ) is now off the end of the string.
yst 12:37
And also assign also can invalidate pointers, references and iterators
yst 12:36
But importantly you don't have any of those
yst 12:35
the pointer still exists, but it can't be dereferenced
yst 12:35
And all of this doesn't matter, because you don't have any char *s, char &s or std::string::iterator objects in your loops
yst 12:34
Any of the non-const members of std::string can do that, which makes all pointers, references and iterators to elements of the string invalid
yst 12:33
What invalidation means, is that if you have a char * pointing at some part of the string, operations on the string that reallocate can, as action-at-a-distance, make that pointer no longer point to a char
yst 12:30
Iterators are a generalisation of pointers. std::string::iterator is allowed to be an alias for char *
yst 12:28
@Giogre I think you misunderstand what "invalidates iterators" means. When you have a std::string::iterator that points somewhere, and do something to the std::string that causes it to reallocate, that iterator no longer points anywhere. You can still assign a new iterator value to that, and it will then point to the new location. In the same way, your indexes no longer point to ( and ) when you replace the bracket with a number, but you don't use those indexes after that, you reassign them
yst 12:28
@Giogre What I'm suggesting is replacing everything from std::string plug_result{}; to input.assign(plug_result) with input.replace(...). I.e. the part where you replace part of input with something else
yst 12:28
@Giogre You are not using any iterators. You take the index of a character after replacing content of input with assign. You can do the same, take the index of a character after replacing content of input with replace.
yst 12:28
@Giogre assigning over it also invalidates iterators, of which you have none. No, string view is a good replacement for const ref, particularly for taking substrings, as it doesn't copy
 
Tue 21:28
And the reason the user doesn't care, is that moved-from objects are either about to be destroyed, or about to be assigned to.
Tue 21:28
@user673679 the user explicitly doesn't care what state the moved-from object ends up, so long as it's assignable or destructable. Which is satisfied by swaping the contents. This is a pattern used by many implementations of the standard library.
Tue 21:28
@user673679 yes, and every resource is closed. The destructor of the moved-to object destroys its resource, and the destructor of the moved-from object destroys its resource
 
Jan 3 16:49
Jan 3 16:34
Pointer is just easier than traversing the hierarchy each time
Jan 3 16:34
It can reasonably be a const pointer, you aren't going to be modifying through it
Jan 3 15:53
Jan 3 15:50
I would prefer unique id's for every entity, rather than pointers for setEmployeeName et. al.
Jan 3 15:49
Something like godbolt.org/z/xM9absrWv
Jan 3 15:45
Your overload of QAbstractItemModel::setData can call the manager class. You don't copy the data. The model looks up the data each time it needs it
Jan 3 15:45
@19172281 I'd use the id's. Each filter model will override QSortFilterProxyModel::filterAcceptsColumn to hide columns it doesn't use, and QSortFilterProxyModel::filterAcceptsRow to hide rows based on ids (that it can store)
Jan 3 15:45
@19172281 parent and grandparent for EmployeeModel, yes
Jan 3 15:45
@19172281 yes, those are separate from the models
Jan 3 15:45
@19172281 you can override QAbstractItemModel::data and QAbstractItemModel::setData to interact with your classes, but you still have to deal with adding / removing / moving rows when the underlying list changes shape, yes
Jan 3 15:45
@19172281 you still have your Employee, Department and Store classes, but you populate EmployeeModel, DepartmentModel and StoreModel as flat tables at the top level
Jan 3 15:45
@19172281 Don't think of QT's model classes as models in the MVC sense. They are more like viewmodels in the MVVM sense.
 
Oct 22, 2024 22:52
@paul23 In the EU a removal company would have a legitimate interest in recording the state of the goods it was moving, and retaining that information for the purpose of defending possible lawsuits. Otherwise step one in suing a removal company would be telling them to destroy all the evidence they could use to defend themselves. You don't have an absolute right to be forgotten in the EU.
Oct 22, 2024 22:52
@paul23 the contractor was there to make a record of goods to be moved. OP seems to be upset about the means the contractor used to make that record
 
Oct 16, 2024 08:14
@kaya3 The process ending is the final collection.
 
Oct 7, 2024 13:27
@kaya3 That's a very pedantic take. And like I say, which particular methodology you use doesn't change the result, that (that poll is predicting) 2024 has the widest divide between men and women. I wrote this answer because, at the time of writing, the other answers were attacking the figure 33, not answering the question
Oct 7, 2024 13:27
@kaya3 The author uses the term "gender gap" in his opening paragraph. 'As it is, the two are clashing in an election marked by a gulf so wide, the phrase “gender gap” doesn’t do it justice.' That's the setup for calling 33 the gender chasm
Oct 7, 2024 13:27
@komodosp that part of my answer is addressing calling it "the gender gap", which does have an academic description. I've re-arranged the answer to put that later than directly answering the question that was asked.
Oct 7, 2024 13:27
@komodosp no, that would be a gap of 25, with the direction from the winner. 33 comes from adding the magnitude of the Harris gap (+18) to the magnitude of the Trump gap (-15). Dividing by two doesn't get you either of those values. You get a 0 if an equal proportion of men and women prefer the leading candidate (before the result) / winner (after the result). E.g. in 1976 Carter won with a gender gap of 0, as he was 50-48 among both men and women
Oct 7, 2024 13:27
@haxor789 There doesn't seem to be reporting of exit poll by demographics for many before 1980, and they were all fairly close
Oct 7, 2024 13:27
@kaya3 I'm not saying that metric is a bad metric. I'm saying that it isn't the gender gap, by the usual definition of that term. I'm also saying which metric is used doesn't change the answer to this question.
Oct 7, 2024 13:27
@NoDataDumpNoContribution For presidential elections, yes. The article isn't claiming there is no issue with a wider gap.
Oct 7, 2024 13:27
@kaya3 the author of the article uses the term "gender gap" as well as "gender chasm", and chasm is used as an intensifier.
 
Sep 13, 2024 11:38
Does this example match what you mean @candied_orange: "It's a massive pain when you have to rename everything from tryJumpOut to jumpOut because v2 of the movement library can jump on a broken leg."?
Sep 13, 2024 11:20
@candied_orange I think we are roughly agreeing then. To the caller, there is no postcondition, so void is fine to return.
Sep 13, 2024 11:12
OP barely describes a situation, so we have no idea
Sep 13, 2024 11:10
@candied_orange I'd classify "writes something to an output port then early return" as "does the domain action" rather than "does nothing", but I can see the other interpretation