Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to construct empty Variant #34

Open
MKostyukhin opened this issue Sep 15, 2022 · 0 comments
Open

No way to construct empty Variant #34

MKostyukhin opened this issue Sep 15, 2022 · 0 comments

Comments

@MKostyukhin
Copy link

MKostyukhin commented Sep 15, 2022

Based on the description the default ctor should construct an empty variant value:

**
     * \brief Construct an empty variant
     *
     * Construct an empty variant
     */
    Variant();

hasValue method always returns 'true' even for the following simple scenario:

assert (Variant<char, int>{}.hasValue() == false); // expectation to have an empty variant here

and there is not bad_cast exception

const auto value Variant<char, int>{}.get<char>();  // there is no `bad_cast` exception, why?

Could you please clarify what is an excepted behavior?

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

No branches or pull requests

1 participant