[tab:optional.swap] (original) (raw)

22 General utilities library [utilities]

22.5 Optional objects [optional]

22.5.3 Class template optional [optional.optional]

22.5.3.5 Swap [optional.swap]

Table 69 — optional​::​swap(optional&) effects [tab:optional.swap]

🔗 *this contains a value *this does not contain a value
🔗rhs contains a value calls swap(*(*this), *rhs) direct-non-list-initializes the contained value of *thiswith std​::​move(*rhs), followed by rhs.val->T​::​~T(); postcondition is that *this contains a value and rhs does not contain a value
🔗rhs does not contain a value direct-non-list-initializes the contained value of rhswith std​::​move(*(*this)), followed by val->T​::​~T(); postcondition is that *this does not contain a value and rhs contains a value no effect