Hmm, I would just write two overloads, one reading, one writing, and stop there. I usually do this for slices too, so one can be const and the other non-const. I assume the want to do this usually appears in member functions in structs and classes.