I have a set of three values, call them x, y, and z. If value A happens to match only one in the set x, y, and z, then that means we have a proper match and we stop searching for a match, even if it is at y. It can match any one in that set. These values x, y, and z are non-constant so I cannot use a switch-case statement.
How do I do ...
I've got a C++ data-structure that is a required "scratchpad" for other computations. It's not long-lived, and it's not frequently used so not performance critical. However, it includes a random number generator amongst other updatable tracking fields, and while the actual value of the generator isn't important, it is important that th...
Here is the problem. I wrote this function to return a reference to the i element of a member vector, so this element could be edited. Here is the code:
Letter& Literal::get (int i) const {
return lit_m.at (i); //Vector of Letter objects
}
But g++ won't let me assign that element to a non-const reference:
g++ -o literal.o -c lite...