Skip to content

Conversation

MimiXav
Copy link

@MimiXav MimiXav commented Dec 20, 2021

No description provided.

Copy link
Contributor

@etnKlendathu etnKlendathu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I need to decline it.

{
public:
constexpr Expected() = delete;
constexpr Expected() = default;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, you cant to have default ctor


Expected(const Expected&) = delete;
Expected& operator=(const Expected&) = delete;
Expected(const Expected& other) = default;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, no copy here

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why should copy not be allowed?

constexpr const T&& value() const&& noexcept;
constexpr T&& value() && noexcept;
constexpr const ErrorT& error() const& noexcept;
constexpr const T& value() const&;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove noexcept?

ErrorT m_error;
};
bool m_isError = false;
std::variant<T, ErrorT> m_value;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not union? this is more efficient type here


Expected(const Expected&) = delete;
Expected& operator=(const Expected&) = delete;
Expected(const Expected& other)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No copy at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants