Remove expected to unexpected orderings

This commit is contained in:
Simon Brand
2017-12-28 09:47:26 +00:00
parent 304eefda71
commit 3adfec7ffc

View File

@@ -686,12 +686,13 @@ struct expected_operations_base<void,E> : expected_storage_base<void, E> {
this->m_has_val = true;
}
// This function doesn't use its argument, but needs it so that code in
// levels above this can work independently of whether T is void
template <class Rhs>
void construct_with(Rhs && rhs) noexcept {
void construct_with(Rhs &&) noexcept {
this->m_has_val = true;
}
template <class... Args> void construct_error(Args &&... args) noexcept {
new (std::addressof(this->m_unexpect))
unexpected<E>(std::forward<Args>(args)...);
@@ -2056,38 +2057,6 @@ template <class T, class E>
constexpr bool operator!=(const unexpected<E> &e, const expected<T, E> &x) {
return x.has_value() ? false : x.error() != e.value();
}
template <class T, class E>
constexpr bool operator<(const expected<T, E> &x, const unexpected<E> &e) {
return false;
}
template <class T, class E>
constexpr bool operator<(const unexpected<E> &e, const expected<T, E> &x) {
return x.has_value();
}
template <class T, class E>
constexpr bool operator<=(const expected<T, E> &x, const unexpected<E> &e) {
return !x.has_value();
}
template <class T, class E>
constexpr bool operator<=(const unexpected<E> &e, const expected<T, E> &x) {
return true;
}
template <class T, class E>
constexpr bool operator>(const expected<T, E> &x, const unexpected<E> &e) {
return x.has_value();
}
template <class T, class E>
constexpr bool operator>(const unexpected<E> &e, const expected<T, E> &x) {
return false;
}
template <class T, class E>
constexpr bool operator>=(const expected<T, E> &x, const unexpected<E> &e) {
return true;
}
template <class T, class E>
constexpr bool operator>=(const unexpected<E> &e, const expected<T, E> &x) {
return !x.has_value();
}
// TODO is_swappable
template <class T, class E,