libstdc++
GNU C++ library
Loading...
Searching...
No Matches

◆ swap()

void std::experimental::fundamentals_v1::any::swap ( any & __rhs)
inlinenoexcept

Exchange state with another object.

Definition at line 244 of file experimental/any.

245 {
246 if (empty() && __rhs.empty())
247 return;
248
249 if (!empty() && !__rhs.empty())
250 {
251 if (this == &__rhs)
252 return;
253
254 any __tmp;
255 _Arg __arg;
256 __arg._M_any = &__tmp;
257 __rhs._M_manager(_Op_xfer, &__rhs, &__arg);
258 __arg._M_any = &__rhs;
259 _M_manager(_Op_xfer, this, &__arg);
260 __arg._M_any = this;
261 __tmp._M_manager(_Op_xfer, &__tmp, &__arg);
262 }
263 else
264 {
265 any* __empty = empty() ? this : &__rhs;
266 any* __full = empty() ? &__rhs : this;
267 _Arg __arg;
268 __arg._M_any = __empty;
269 __full->_M_manager(_Op_xfer, __full, &__arg);
270 }
271 }
bool empty() const noexcept
Reports whether there is a contained object or not.
any() noexcept
Default constructor, creates an empty object.
void(* _M_manager)(_Op, const any *, _Arg *)

References any(), std::experimental::fundamentals_v1::any::_Arg::_M_any, _M_manager, _Op_xfer, and empty().

Here is the call graph for this function: