I have noticed that it is currently not possible to iterate over the elements of a constant reference - even if it is read only. However it seems to me that there is no reason for the Element and RangeSetBase class to store a nonconstant pointer. Note that this does NOT mean, that the pointer cannot change, we can still set it to nullptr or a different mesh - only the value that the pointer points to cannot, i.e. we would not be allowed to change element.getMesh()
I have implemented this for the Element class and it seems to work flawlessly. Is there any point where the elements require non-constant references?