Instead of being a static function with a dynamic_cast in it, maybe it would be cleaner for this to be a member of MemoryVectorNode and having the dynamic cast from the caller, because anyway it is called from a single location.