Problem with std::pair<..., rva::self_t> - explicitly OR when using std::map<..., rva::self_t>
robertroessler opened this issue · 0 comments
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".