Add a new function: Registry::getElementsCopy()

Add a test that registers functions, which register and remove other
functions or themselves from the registry. When not using a copy of the
registered elements, the test crashes, because invalid iterators are
accessed. In such cases, where functions that are called change the
registry, getElementsCopy() must be used to iterate over the registered
elements.