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

Method value_or

src/butil/containers/optional.h:345–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

343 // otherwise returns default `v'.
344 template <typename U>
345 constexpr T value_or(U&& v) const& {
346 static_assert(std::is_copy_constructible<value_type>::value,
347 "T can not be copy constructible");
348 static_assert(std::is_convertible<U&&, value_type>::value,
349 "U can not be convertible to T");
350
351 return static_cast<bool>(*this) ? **this : static_cast<T>(std::forward<U>(v));
352 }
353 template <typename U>
354 T value_or(U&& v) && {
355 static_assert(std::is_move_constructible<value_type>::value,

Callers 2

TESTFunction · 0.80
operator()Method · 0.80

Calls 1

moveFunction · 0.50

Tested by 1

TESTFunction · 0.64