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

Problem with std::pair<..., rva::self_t> - explicitly OR when using std::map<..., rva::self_t> #3

Open
robertroessler opened this issue Jun 21, 2023 · 0 comments

Comments

@robertroessler
Copy link

robertroessler commented Jun 21, 2023

Having a great time with rva::variant - thanks! - as long as I only had a std::vector with a recursive reference.

Now that I am - possibly humorously, given your motivating sample - implementing a "JSON" value type, I run into trouble trying to build iff I include the "map" recursive reference mentioned above... this is with VS 2022 17.6.4 in C++20 language mode.

What happens is we get nailed on your line 38/39

constexpr static bool
nothrow_swappable = std::is_nothrow_swappable_v<base_type>;

... with the complaint that [effectively] base_type is undefined - even though you have just defined it on the previous line with some of your "replace" magic. :( As I mention in the issue title, this happens with either map or pair, as the actual problem is in pair, but map uses pairs etc.

I can, of course, make the build complete if I just remove the above constexpr static - and the single use in the definition of rva::variant::swap - But That Would Be Wrong(tm), not to mention having the noexcept-ness wrong one way or the other. ;)

Any ideas/suggestions/comments?

For anyone that finds this, I am adding a comment on my issue: just removing the "offending" declaration of the constexpr value nothrow_swappable seems to solve the compile problem, i.e., just plug the std::is_nothrow_swappable_v<base_type> directly in as the value of the noexcept expression in the definition of "swap".

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