typeSafeUnion function

Union two vectors without changing their data types.