File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -780,6 +780,36 @@ class LocatorPathElt::ArgumentAttribute final : public StoredIntegerElement<1> {
780
780
}
781
781
};
782
782
783
+ namespace details {
784
+ template <typename CustomPathElement>
785
+ class PathElement {
786
+ static constexpr bool hasStoredValueImpl (...) { return false ; }
787
+
788
+ template <unsigned N>
789
+ static constexpr bool hasStoredValueImpl (StoredIntegerElement<N> *) { return true ; }
790
+
791
+ template <typename T>
792
+ static constexpr bool hasStoredValueImpl (StoredPointerElement<T> *) { return true ; }
793
+
794
+ public:
795
+ static constexpr bool hasStoredValue () {
796
+ return hasStoredValueImpl (static_cast <CustomPathElement *>(nullptr ));
797
+ }
798
+ };
799
+ }
800
+
801
+ template <typename CustomPathElement>
802
+ constexpr bool isValidCustomPathElement () {
803
+ return details::PathElement<CustomPathElement>::hasStoredValue ();
804
+ }
805
+
806
+ // All custom path element classes must inherit from StoredIntegerElement or StoredPointerElement
807
+ #define CUSTOM_LOCATOR_PATH_ELT (Name ) \
808
+ static_assert (isValidCustomPathElement<LocatorPathElt::Name>(), \
809
+ " Custom path elements must inherit from StoredIntegerElement or StoredPointerElement" );
810
+ #include " ConstraintLocatorPathElts.def"
811
+
812
+
783
813
// / A simple stack-only builder object that constructs a
784
814
// / constraint locator without allocating memory.
785
815
// /
You can’t perform that action at this time.
0 commit comments