◆ swap()

template<class T>
__thrust_exec_check_disable__ __host__ __device__ void thrust::optional< T >::swap ( optional< T > &  rhs)

Swaps this optional with the other.

If neither optionals have a value, nothing happens. If both have a value, the values are swapped. If one has a value, it is moved to the other and the movee is left valueless.

References thrust::addressof(), thrust::optional< T >::has_value(), and thrust::swap().