rewritten vector serializer as std::transform