MCPcopy Create free account
hub / github.com/apache/brpc / swap

Method swap

src/butil/containers/optional.h:364–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

362 }
363
364 void swap(optional& rhs) noexcept {
365 if (_engaged && rhs._engaged) {
366 std::swap(**this, *rhs);
367 } else if (_engaged) {
368 rhs = std::move(*this);
369 reset();
370 } else if (rhs._engaged) {
371 *this = std::move(rhs);
372 rhs.reset();
373 }
374 }
375
376 // Destroys any contained value if the `optional` is not empty.
377 void reset() {

Callers 1

swapFunction · 0.45

Calls 3

swapFunction · 0.70
moveFunction · 0.50
resetMethod · 0.45

Tested by

no test coverage detected