Clean up some code in AffineConstraints::is_consistent_in_parallel.
The existing code has a lambda function that either returns a reference to
an existing element of a vector, or to a dummy member variable. But to
make things confusing, it *modifies* this dummy variable, which means that
what looks like some 'const' dummy object is not actually.
All of this is done to avoid copies, but in reality a copy is still
made at a later point where we insert the result of this lambda
function into a vector. This patch cleans this up by removing the
non-const dummy variable and instead just returning a copy that is
then moved into the vector. That's the same number of copies as before,
in most cases, and it's clearer to read because there is no more
potential for two parts of the code stepping on each others' toes
modifying the dummy variable.
These things are important to me because modifying the dummy variable
is a sure way to introduce really hard to find errors if anyone ever
wanted to multi-thread this function. It's not likely that anyone
will try this for this function soon, except possibly by using
things like parallel-for loops should they ever become available.
But it's worth not even getting into the habit of using this style.
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams