Open ldionne opened 6 years ago
Hi; I asked the question. What does MCD mean?
In any case, such a construct would be nice. In general, I must admit that I am struggling to intuit the correct way of using the library in many cases. I pin this as my own fault; I had problems like this when starting to use range-v3, for example, and now I'm loving the library. So probably I need to slog through the hard part!
MCD means "Minimal Complete Definition".
To be a hana::Struct
a type must have an implementation of hana::accessors
which does not have an interface to let you get the raw type of the member.
Ok, thanks for the information. I'm a beginner with this stuff, so I can't speak to the wisdom of expanding the MCD to allow this. Perhaps adding an example or a subheading to the docs would suffice, although personally I prefer the ergonomics of @ldionne's suggestion. Also: if everyone is using the macros to generate the underlying machinery anyway, then my naive thought is what's the problem (with breaking) :)
I got this question by email, I'm posting it here for exposure (edited at will by myself):
You could also do this:
But this suffers from limitations if you have reference or array types -- it will decay them, and it's still not as short and sweet as it could be. I could add this:
But I'm worried this would require changing the MCD of
Struct
to do it properly, and that's a breaking change.