This is another fragment of improvements from #10785.
The current serialization code does not support serializing/deserializing from/to temporaries (like s >> CFlatData(script)). As a result, there are many invocations of the REF macro which in addition to changing the reference type also changes the constness. This is unnecessary in C++11 as we can use rvalue references now instead.
The first commit is an extra simplification we can make that removes the duplication of code between READWRITE and READWRITEMANY (and related functions).