-
Notifications
You must be signed in to change notification settings - Fork 20
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
Extend requirement system to optional properties #117
base: master
Are you sure you want to change the base?
Conversation
Thanks for this very nice proposal. Does that make sense ? |
Another question: could you demonstrate the use of the conditional capabilities usage ? (maybe a test of the macro |
The problem is that it is difficult to know in advance if a capability is unique or not. |
I added a small test for |
We need to take some time to discuss this AFK: some fitting extensions are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about highlighting storage-only capabilities, as suggested for curvature ?
{ | ||
PROVIDES_PRINCIPAL_CURVATURES | ||
}; | ||
PROVIDES(PRINCIPAL_CURVATURES); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PROVIDES(PRINCIPAL_CURVATURES); | |
PROVIDES(PRINCIPAL_CURVATURES_STORAGE); |
9de1f90
to
a28ebf7
Compare
This is a draft for #107.
The requires/provides system is updated to handle optional capabilities that can be checked at compile-time.
Enums are replaced by
constexpr bool
data members and the verification is done using SFINAE.Things that change
PROVIDES(CAPABILITY)
REQUIRES(CAPABILITY)
IS_PROVIDED(CAPABILITY))
checks at compile-tile if a capability is provided or not by a base classPROVIDES_...
are removed (they are nowconstexpr bool
, and someone that usesmyfit.PROVIDES_PLANE
might still do the same sincePROVIDES(PLANE)
actually declares a data member namedPROVIDES_PLANE
)Note that a class can still override a capability and no error or warning is printed.
I was thinking about printing at least a warning, but there are some capability such as
NORMAL_DERIVATIVE
that is provided by bothMlsSphereFitDer
andOrientedSphereDerImpl
, but it is not really a programming mistake, one class overrides the capability and by design inherits the other class.Potential next steps
FIT(PLANE)
that check if there is no other class that also fits the plane (in replacement to the run-timeisValid()
function)Since
enum {Check = PROVIDES_PLANE}
is replaced byPROVIDES(PLANE)
, I changed all references ofPROVIDES_PLANE
toPLANE
in the documentation.