codeinred / recursive-variant Goto Github PK
View Code? Open in Web Editor NEWRecursive Variant: A simple library for Recursive Variant Types
License: Other
Recursive Variant: A simple library for Recursive Variant Types
License: Other
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".
For example, a list can be defined in Haskell as List a = Nil | Cons a (List a)
, can we support it by changing std::tuple
and std::variant
? Going a step further, can we do it at zero cost?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.